C++ code pls write the code

C++ Code Pls Write The Code

Answers

Answer 1

Answer:

Following are the code to this question:

#include<iostream>//defining header file

using namespace std;

class vec//defining class vec  

{

int x, y, z; //defining integer varaible x, y, z

public: // using public access specifier

vec() //defining default constructor

{

   x = 0; //assign value 0 in x variable  

   y = 0; //assign value 0 in y variable

   z = 0;//assign value 0 in z variable

}

vec(int a, int b , int c) //defining parameterized constructor vec

{

   x = a; //assign value a in x variable

   y = b; //assign value b in y variable

   z = c;//assign value c in z variable

}

void printVec() //defining a method printVec

{

   cout<<x<<","<<y<<","<<z<<endl; //use print method to print integer variable value

}

//code

vec& operator=(const vec& ob) //defining operator method that create object "ob" in parameter  

{

x=ob.x; //use ob to hold x variable value

y=ob.y;//use ob to hold y variable value

z=ob.z;//use ob to hold z variable value

return *this;//using this keyword to return value  

}

};

int main()//defining main method

{

vec v(1,2,3);//calling parameterized constructor

vec v2; //creating class object to call method

v2=v; //creatring reference of object

v2.printVec(); //call method printVec

return 0;

}

Output:

1, 2, 3

Explanation:

In the above-given code part, a method "operator" is defined, that accepts an object or we can say that it is a reference of the class "ob", which is a constant type. Inside the method, the object is used to store the integer variable value in its variable and use the return keyword with this point keyword to return its value.    


Related Questions

Read the following code:

x = currentAge
print(x + 20)

What value will this code calculate?

Select one:
a. Age in 20 years
b. Age 20 years ago
c. Age at 20 years old
d. Age in the year 2020

Answers

Answer:

The answer is "A) Age in 20 years"

Explanation:

Assuming currentAge is declared and is an integer, you are adding 20 to your current age which means it will print your age in 20 years.

Its Option A - Age in 20 Years.
Thank You!

Which of the following HTML structures arranges text in multiple rows and columns?
a.
b.
c.
d.

Answers

Answer:

b. <table>

Explanation:

HTML is an acronym for hypertext markup language and it is a standard programming language which is used for designing, developing and creating web pages.

Generally, all HTML documents are divided into two (2) main parts; body and head. The head contains information such as version of HTML, title of a page, metadata, link to custom favicons and CSS etc. The body of the HTML document contains the contents or informations of a web page to be displayed.

A <table> is a HTML structure that arranges text in multiple rows and columns. Other data that can be arranged into rows and columns in a HTML table are images, links, and other tables. Each row in a table is denoted with a <tr> tag.

C# The video game machine at your local arcade output coupons according to how well you play the game. You can redeem 10 coupons for a candy bar or 3 coupons for a gumball. You prefer candy bars to gumballs. Write a program that defines a variable initially assigned to the number of coupons you win. Next, the program should output how many candy bars and gumballs you can get if you spend all of your coupons on candy bars first, and any remaining coupons on gumballs.

Answers

Answer:

#include<iostream>

using namespace std;

/* main is a function without a parameters which returns an int value*/

int main( )

{

/* declare int data type for numeric values initialize candyBar and gumBall */

int coupons, cabdyBr=10,gumall=3;

int candyBarAmount,gumBallAmount,remainder;

/* cout is used to show the message to user cin to read user input from keyboard and sets the value to coupon */

cout<<"Enter the number of coupons"\t";

cin>>coupons;

/* First check coupons with cabdyBar */

if (coupons >= candyBar)

{

candyBarAmount=coupons/candyBar;

remainder=coupons-(candyBarAmount*10);

}

else

{

candyBarAmount=0;

}

/* check remaining value with gumBall */

if (remainder<<candyBar && remainder>=gumBall)

{

gumBallAmount=remainder/gumball;

}

else

{

gumBallAmount=0;

}

/* show thw required output to the user */

cout<<"The number of Candy bars is "<< candyBarAmount <<endl;

cout<<"The number of gumballs is "<<gumballAmount <<endl;

/* The program ends and return 0 as the functions value */

return 0;

}

OUTPUT

Enter the number of coupons: 23

The number of candy bars = 2

The number of gumballs = 1

Does the submission include the file "SuperPower.java"? Does the file include a public class called "SuperPower"? Does the class include a public method called "main"? Is the "main" method static? Does the main method have a String assignment statement that uses "JOptionPane.showInputDialog"? Does the main method have a statement that uses "JOptionPane.showMessageDialog"? Does the program convert the String from "JOptionPane.showInputDialog" using the "toUpperCase" method? Does the submission include a screenshot that shows an Input dialog that asks, "What is your superpower?" Does the submission include a screenshot that shows a Message dialog stating " TO THE RESCUE!", where "" is the input converted to upper case?

Answers

Answer:    

Here is the program fulfilling all the requirements given:

import javax.swing.JOptionPane;      

public class SuperPower{

public static void main(String[] args) {

String power;

power = JOptionPane.showInputDialog("What is your super power?");

power = power.toUpperCase();

JOptionPane.showMessageDialog(null, power);} }

Explanation:

Does the file include a public class called "SuperPower"

See the statement:

public class SuperPower

Does the class include a public method called "main"? Is the "main" method static?

See the statement:

public static void main(String[] args)

Does the main method have a String assignment statement that uses "JOptionPane.showInputDialog"

See the statement:

power = JOptionPane.showInputDialog("What is your super power?");

Does the main method have a statement that uses "JOptionPane.showMessageDialog"?

See the statement:

JOptionPane.showMessageDialog(null, power);

Does the program convert the String from "JOptionPane.showInputDialog" using the "toUpperCase" method?

See the statement:

power = power.toUpperCase();

Does the submission include a screenshot that shows an Input dialog that asks, "What is your superpower?" Does the submission include a screenshot that shows a Message dialog stating " TO THE RESCUE!", where "" is the input converted to upper case?

See the attached screenshots

If the program does not let you enter an exclamation mark after "to the rescue" then you can alter the code as follows:

import javax.swing.JOptionPane;

public class SuperPower{

public static void main(String[] args) {

String power;

power = JOptionPane.showInputDialog("What is your super power?");

power = power.toUpperCase();

JOptionPane.showMessageDialog( null, power+"!");} } // here just add an exclamation mark which will add ! after the string stored in  power

Digital information processed into a useful form is

Answers

Answer:

Output

Explanation:

Using computer software, compare the 2016 year-to-date sales through February to the 2017 year-to-date sales through February for each manufacturer by computing the difference. Using computer software, sort the list of the manufacturers in order of largest to smallest difference in year-to-date sales. Which manufacturers are in the top five with increased sales

Answers

Incomplete question. Here's a similar question found in the attachments.

Answer:

General Motors Corp, Chrysler, Ford Motor Company, Toyota Motors sales USA Inc, Nissan North America Inc.

Explanation:

By, using the MS Excel computer software, you would be able to compare the 2016 year-to-date sales through February 2017 year-to-date sales for each manufacturer.

Simply copy the data into the data cells of MS Excel, next use the =sum formula (which should have a minus sign; For example, =SUM (B5 - E5) would give you the difference between the 2016 sales and 2017 sales, only if sales for 2016 is found in column B row 5 and sales for 2017 in column E row 5).

Thus, the results obtained can further be evaluated to determine the manufacturers in the top five with increased sales.

identify the benefit of modeling to communicate a solution. ​

Answers

Answer:

provides a graphical design or representation of solution with symbols.

Explanation:

Communication models help identify and understand the components and relationship of the communication process being studied. Models represent new ideas and thought on various aspects of communication which helps us to plan for effective communication system.

Answer: D

Explanation:

>>> from hog import *
>>> test_dice = make_test_dice(4, 6, 1)
>>> test_dice()______
>>> test_dice() # Second call
______
>>> test_dice() # Third call______
>>> test_dice() # Fourth call

Answers

Answer:

This Python code is an implementation of an anonymous function like a lambda function in other function.

Explanation:

The function 'make_test_dice' with the arguments 4, 6 and 1, returns a lambda function to the test_dice variable.

The test_dice is called with parenthesis to run the lambda function. This implementation is used to hide a parameter in a calculation or process.

Imagine you were using some of our pixelation tools to create an image and you posted it online for your friends to see - but, a week later you find out someone took that image and put it on a T-shirt that they’re selling for $10 each.


Now that we understand Copyright, what would need to change in order for the scenario from the warm-up to be okay?

Answers

Answer:

I will develop a CREATIVE COMMONS LICENSE

Explanation:

Based on the scenario given what i would need to change for the scenario from the warm-up to be okay is for me develop CREATIVE COMMONS LICENSE and the reason why I would develop this type of license is that it will enable people or the public to freely make use of my work or have free licence to the work that I have created by freely using it on their own products which will enables them to sell their work which have my own work on them easily and freely without any form of restrictions.

Copyright allows the creator or owner of a property (usually intellectual property) to have an absolute right over his property.

What needs to be done in this scenario is to create a creative common license.

In copyright, creative common license allows the members of the public to make use of an intellectual property for free, while the owner still retains the ownership and right, over the property.

When the creative common license is done, the seller of the T-shirt can sell the T-shirt without remitting any incentive to you; however, the seller gives you credit and recognition for the image.

Read more about copyrights at:

https://brainly.com/question/17357239

A coach wants to divide the basketball team into two groups for a practice game. Which statistical measurement is the coach most likely to use?
A) percentile
B) mean
C) median
D) mode

Answers

Answer:

median

Explanation:

Answer:

C) Median

Explanation:

Which symbol is at the beginning and end of a multiline comment block?

Answers

The beginning of a block comment or a multi-line comment is marked by the symbol /* and the symbol */ marks its end.

What does the security element of non-repudiation mean in e-commerce cybersecurity? A. Data needs to be available at all times. B. Only authorized personnel can access data. C. Each website should have privacy control settings. D. Clients cannot refuse to make payments once they place an order.

Answers

Answer:

Non-repudiation is the assurance that someone cannot deny the validity of something. Non-repudiation is a legal concept that is widely used in information security and refers to a service, which provides proof of the origin of data and the integrity of the data

Explanation:

Answer:

Clients cannot refuse to make payments once they place an order.

Explanation:

PLATO Cyber-security

I got 5/5 on the quiz.

the time a computer takes to start has increased dramatically, one possible explanation for this is that the computer is running out of memory. this explanation is a scientific....
a. hypothesis
b. experiment
c. observation
d. conclusion

Answers

Answer:

A

Explanation:

The appropriate answer will be Option c (observation).

Being able to comprehend or recognize something or be able to notice it his ability to observe in great depth is evident in every explanation or statement, which would be determined as an Observation.The result of observing or noting something, and then forming or expressing a judgment or a king of opinion.

The other given choices,

Experiment or hypothesis - Tests are used to examine a hypothesis or maybe even a concept through the utilization of such an experiment.

Conclusion - The final component of anything or a conclusion made following considerable deliberation.

Are not related to the given scenario. Thus the above option is the right one.

Learn more about observational learning here:

https://brainly.com/question/21861086

Question 4
When something is saved to the cloud, it means it's stored on Internet servers
instead of on your computer's hard drive.

Answers

Answer:

Wait is this a question or are you for real

Answer:it is stored on the internet server instead

of your computer's hard drive.

Explanation:

the cloud is the Internet—more specifically, it's all of the things you can access remotely over the Internet.

Chunking is a good strategy for completing large assignments because it makes the work
O less boring.
more thorough.
less difficult
O more manageable.

Answers

I think it would be the fourth answer choice.

Answer:

D. more manageable

Explanation:

it wouldn't make the work less boring, wont make work less difficult and and it wont help u get more through quicker

Input a double and print the first two digits after the decimal point with a space between them. Sample run: Please input a decimal number: 57.8934 Answer: 8 9 Hint - to complete the second coding activity in lesson 5 you had to learn how to get individual digits from an int value. You can reuse this method once you convert the user input to an appropriate int value (you will need both multiplication and casting for this).

Answers

Answer:

number = float(input("Please input a decimal number: "))

number = int (number * 100)

second_digit = number % 10

first_digit = int(number / 10) % 10

print("Answer: " + str(first_digit) + " " + str(second_digit))

Explanation:

Ask the user to enter a decimal number (number = 57.8934)

Multiply it by 100 (number = 5789.34) and typecast to int (number = 5789)

Use the module to get the second digit (9)

Divide the number by 10 (578.9), typecast to int (578) and use module operator to get the first digit (8)

Print the numbers as requested

The code is:

int main(){

double n;

int v, d;

scanf("%lf\n", &n);

n = n*10;

v = (int)n;

d = v%10;

printf("The first digit is %d\n", d);

n = n*10;

v = (int)n;

d = v%10;

printf("The second digit is %d\n", d);

return 0;

}

----------------------

To get each decimal digit, we multiply by 10 until the digit, then calculate the remainder of the operation(mod) of the integer part relative to 10.For example:

57.8934 x 10 = 578.934

The integer part is 578.

The remainder of the division of 578 by 10 is 8.

Now, we have to generalize it, thus:

int main(){

double n;

int v, d;

scanf("%lf\n", &n); -> Reads the double;

/*First digit*/

n = n*10; -> Multiplies by 10.

v = (int)n; -> Casts the integer part

d = v%10; 0 -> Remainder relative to 10 to get the first digit.

printf("The first digit is %d\n", d);

/*Second digit -> Does the same thing*/

n = n*10; -> Multiplies by 10.

v = (int)n; -> Casts the integer part

d = v%10; 0 -> Remainder relative to 10 to get the first digit.

printf("The second digit is %d\n", d);

return 0;

}

A similar problem is given at https://brainly.com/question/18340665

Complete the statement below with the correct term.

A single-mode
uses a single ray of light, called a mode, to transmit data.

Answers

Answer:

Its Fiber

Explanation:

Trust me

Answer:

Data transfer through the core using a single light ray (the ray is also called a mode).

The core diameter is around 10 microns.

At distances up to 3 km, single mode delivers data rates up to 10 Gbps.

Cable lengths can extend a great distance. Or FIBER

Explanation:

hope this helps

To the greatest extent possible, coalition members should _____.

Answers

Answer: consider the ramifications of labeling information about operational areas as intelligence

Explanation:

The options to the question are:

a. consider the ramifications of labeling information about operational areas as intelligence

b. prevent the sharing of relevant intelligence about the situation and adversary

c. occasionally seek the necessary authorization for foreign disclosure of information

d. disseminate information freely without a tear line.

To the greatest extent possible, coalition members should, consider the ramifications of labeling information about operational areas as intelligence.

It should be noted that security operations activities are conducted by U.S. forces in order to demonstrate the commitment of the U.S to its alliances, and also enhance regional stability.

1) You have a class called Sheep that wants to keep track of how many Sheep have ever been created. Where is a good place to put that variable? 2) When an h file mentions another class, what is that called? (When a cpp file needs to use a class, they include it. This is an h file just mentioning a class, like it has a pointer of that type. You are promising the compiler that the class is in another file.) 3) What is a good guideline for deciding you must write a copy constructor, an assignment operator, and a destructor? 4) void Rock::Func( const Rock & X){} What is that argument type called and what does it do? 5) We saw overloading the = sign. How do you declare a class wanting to override the parenthesis operator?

Answers

Answer:

The counter variable for the sheep count should be declared and initialized before the constructor in the class. The extern keyword should be used to declare the class in the receiving C source file. A constructor is defined when there is a need to instantiate an object with an argument and an assignment operator is used to initialize a variable. The const keyword is used to specify a variable whose value should not change during the course of the program execution.

Explanation:

The C programming language is an object-oriented programming language and has variable specifiers to define variable scopes in a program.

Instructions
Currently, this program will add 6 and 3 together, output the math problem and output the answer. Edit this code so that a random number is generated from 1 - 10 (inclusive) for the variables a and b. Also, instead of adding the two numbers together, the edited program should multiply them, and output the proper math problem and answer. Be sure to update every line of code to reflect the changes needed. import random

Answers

Answer:

The original program is not given; So, I'll just write the program myself in python

import random

x = random.randint(1,10)

y = random.randint(1,10)

result = x * y

print(str(y)+" * "+str(x)+" = "+str(result))

Explanation:

The first line imports random

import random

The next two line generates random numbers between 1 and 10 and save in variables x and y

x = random.randint(1,10)

y = random.randint(1,10)

This line multiplies both numbers

result = x * y

This line prints the result

print(str(y)+" * "+str(x)+" = "+str(result))

The modified program written in python 3 is given below :

import random # import the random module for generating random numbers

a = random.randint(1, 11)#a random integer value between the values (1 and 10) is attached to variable a

b = random.randint(1,11)#a random integer value between the values (1 and 10) is attached to variable b

answer = a * b# multiplies the value of a and b and attach the result to the variable answer

print(str(a) + " * " + str(b) + " = " + str(answer))#displays the operation and result obtained as a string.

Learn more on python programs :https://brainly.com/question/16674303

Maia wants to left align her paragraphs. Which button does she press?
o

Answers

the answer is the 2nd one because the 2nd and 4th line is moved over to the left

Answer:

It's B

Explanation:

On edge 2021

ethical issues of cyber bullying

Answers

Answer:

Explanation: As a student, I am aware of the existence of Cyber-bullying and the manner in which it can be carried out. I am also sensitive to the serious nature of the problem. However, I realise that I need to know more about the issue if I am to be effective in fostering a supportive learning environment in which students can grow as good digital citizens.

Cyber-bullying is similar to traditional psychological bullying in that-

There is an imbalance of power between the victim & perpetrator.

Victims draw negative attention & are isolated from their peer group.

Perpetrators are often encouraged & supported by their peer group.

The actions of the perpetrator are deliberate, repeated & relentless.

The negative attention is uninvited & unwanted by the victim.

The effects often cause depression, anxiety, low self-esteem, poorer mental & physical health and school avoidance.

A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk and the profit of each carton of milk vary from farm to farm. Write a program that prompts the user to enter: The total amount of milk produced in the morning. The cost of producing one liter of milk. The profit on each carton of milk. The program then outputs: The number of milk cartons needed to hold milk. Round your answer to the nearest integer. The cost of producing milk. The profit for producing milk.

Answers

Answer:

milk_produced = float(input("Enter the total amount of milk produced in the morning: "))

liter_cost = float(input("Enter the cost of producing one liter of milk: "))

carton_profit = float(input("Enter the profit on each carton of milk: "))

carton_needed = round(milk_produced / 3.78)

cost = milk_produced * liter_cost

profit = carton_profit * carton_needed

print("The number of milk cartons needed to hold milk is " + str(carton_needed))

print("The cost of producing milk is " + str(cost))

print("The profit for producing milk is " + str(profit))

Explanation:

*The code is in Python.

Ask the user to enter milk_produced, liter_cost and carton_profit

Calculate the number of milk cartons needed, divide the milk_produced by the capacity (3.78) of a cartoon and round the result

Calculate the cost, multiply the milk_produced by liter_cost

Calculate the profit, multiply the carton_profit by carton_needed

Print the results

A file with a com extension is most likely to be a(n) ___ file.

Answers

I think that the answer is: A executable

What are the differences between an Api Controller and "regular/view" Controller in .Net?

Answers

Answer:

An API controller in .Net is a code statement or function that returns data and a RESTful API to the application while a regular or view controller is a class that returns a view.

Explanation:

The .Net framework is a platform used for creating user-friendly and user interactive interfaces in desktop and web applications. Like all programming frameworks, it uses API and API controllers to source data and other properties.

cellular digestion associated by what organelles?​

Answers

Answer:

lysosomes

Explanation:

Cell Digestion and the Secretory Pathway. The primary sites of intracellular digestion are organelles known as the lysosomes, which are membrane-bounded compartments containing a variety of hydrolytic enzymes.

It it associated with lysosomes

The parameter passing mechanisn used in C is

Answers

Answer:

Hope you understand this answer

Pass by value is the answer

A disadvantage to using open source software is

it may restrict your ability to customize the software to suit your needs.

a higher level of technical skill may be required to install, use, or modify it.

you will need to find the developers who created the software to request their permission to reuse the source code.

you can use the software only if you make a donation to an open-source nonprofit organization

Answers

Answer: a higher level of technical skill may be required to install, use, or modify it.

Explanation:

Answer:

B. a higher level of technical skill may be required to install, use, or modify it.

Explanation:

Which of the following is NOT a popular computer programming
language?
C++
Xero
C#
Java

Answers

Answer is Xero. All the other Languages are Popular and Widely Used.
Thank You!

The computer programming  language i.e. not popular is Xero.

The following are the popular computer programming  language:

C++C#Java

The computer programming  language is the language that is applying for writing the programs.

Therefore we can conclude that the computer programming  language i.e. not popular is Xero.

Learn more about the computer here: brainly.com/question/24504878

can someone explain to me what coom means? kekw

Answers

If it is espanish it is como and it means how.

Answer:

Outside of referring to the image and meme, Coomer, often lowercased as coomer, is used online as a general insult for an overshrexed young man. The term implies such a person is a sleazy loser, obsessed with masturbatling to pronography because he can't find shrexual partners.

Other Questions
1Select all the correct answers.The Scientific Revolution played a major role in the emergence of the Industrial Revolution. Which two statemeRevolution's impact on society?The industrial growth boosted economic growth in parts of Europe.The industrial growth caused bankruptcy for all new factories in Europe.The new industrial technologies improved means of transportation.The industrial developments caused friction between Europe and North America.ResetNext Which passages from The Cask of Amontillado support the idea that Fortunato is not suspicious toward the narrator?Select all that apply.The Cask of AmontilladoHe accosted me with excessive warmth, for he had been drinking much.A succession of loud and shrill screams, bursting suddenly from the throat of the chained form, seemed to thrust me violently back.The vaults are insufferably damp. They are encrusted with niter.Let us go, nevertheless.It must be understood, that neither by word nor deed had I given Fortunato cause to doubt my good-will. Which the these questions is scientific La cultura hispana en USACual la importancia de los siguientes 10 aspectos y ejemplos1- la comida2- la ropa3- la comunicacin no verbal (contacto de los ojos, el acto de tocar las personas etc)4- la puntualidad5- los das festivos6- la msica7- la religin 8- relaciones familiares9- los pasatiempos10- los deportes11- los valores bsicos12- Una costumbre que distingue a esta cultura What economic challenges is Saudi Arabia facing today? How do you remember spanish In which Quadrant is the point (4, -2) located?Quadrant 3Quadrant 1Quadrant 40 Quadrant 2 what is 91,007,500 in scientific notation? Point B lies on AC between A and C. If AB = 8 and AC = 10, find BC. how does a dilation change a figure Urgent! :Describe what sociologists mean by culture During which event did American Indians become allies with English colonists and fight other American Indians? The Pequot War the Protestant Reformation the first Thanksgiving the Great Migration If it takes a company 4 hours to build 1,300 cell phones, at the same rate it will take the company n hours to build 39,000 cell phones. Question 4 (10 points)Read the passages from the article "Kids Save the Day-'Heroes' Deemed by Coast Guard!" Then answer the question about implicit and explicitideas."Wow. What is that?" Simon Brimm remembers calling out to his long-time friend, Hillary Green. He and Hillary had been friends sincepreschool, but they lived in different parts of the state now. They hadn't seen each other all summer. Simon, Hillary, and their families weretaking a vacation together before middle school started next week. Zavier Gonzales and his cousins were also vacationing at the seaside thatweekend. The wind had picked up and the seas were quite rough as swimmers, water boarders, and surfers struggled to stay afloat. Separatedfrom his family, and adrift on a small raft, it was Xavier that Simon saw bobbing along on the horizon.Separated from his family, and adrift on a small raft, it was Xavier that Simon saw bobbing along on the horizon.What implicit idea is suggested by the author's use of "adrift"? (5 points)OaObOdXavier was not on a water board, so he could not stay afloat.Xavier did not have control of the raftThe reshof Xavier's family were also bobbing on the waves.The calm seas made drifting pleasurable. Select the correct answer.Which of these sentences is correctly written?OAOB.It's difficult to predict the effects of new policys and procedures.It's difficult to predict the effects of new policies and procedures.Its difficult predict the affects of new policys and procedures..OD.It's difficult predict the affects of new policies and procedures.ResetNext Write the values that make the denominators zero. then solve the equation? 10/5x-5 + 1/5 = 2/x-1 Between what two integers does the square root of 14 lie? If you have a document that is relevant to more than one folder in your computer what should you do? Why was the Mississippi River important in the early 1700's? BC = 4x + 2 AB = 8x + 8 and AC = 22 Find BC