1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
almond37 [142]
3 years ago
5

Write a C++ programthat simulates a cash register. The user should keeptyping

Computers and Technology
1 answer:
-Dominant- [34]3 years ago
6 0

Answer:

//C++ code for the cash register..

#include <iostream>

#include<vector> //including vector library

using namespace std;

int main() {

vector<float> cash; //declaring a vector of type float.

float item=2,cash_sum=0;

int counter=1;

while(item!=0)//inserting prices in the vector until user enters 0...

{

    cout<<"Enter the price of item "<<counter<<" :"<<endl;

cin>>item;

counter++;

cash.push_back(item);//inserting element in the vector...

}

for(int i=0;i<cash.size();i++)//looping over the vector...

{

    cash_sum+=cash[i];//summing each element..

}

cash_sum*=1.08;//adding 8% sales tax.

cout<<cash_sum;//printing the result....

return 0;

}

Explanation:

I have taken a vector of type float.

Inserting the price of each item in the vector until user enters 0.

Iterating over the vector for performing the sum operation.

Then after that adding 8% sales tax to the sum.

Printing the output at last.

You might be interested in
A(n) ____________ is a group of similar or identical computers, connected by a high-speed network, that cooperate to provide ser
scoundrel [369]

Answer:

cluster

Explanation:

A cluster in a computer system is a collection of servers and other resources that work together to provide high reliability and, in certain situations, load balancing and parallel processing.

6 0
2 years ago
Three of the following values could be stored as strings. When would you NOT use a
kifflom [539]

Answer:

To store decimal values

Explanation:

If values are not to be used for calculation, that is, they are not numerical data, therefore, some of them could be stored as strings. A string may contain any sequence of characters. The characters in a string may be repeated.

From the foregoing, decimals can not be stored as strings because in computer programming, a string is normally a sequence of characters, hence the answer above.

5 0
3 years ago
My assignment asks me to write a python program using if, elif, and else that takes a user's salary and calculates the tax based
Goryan [66]

Answer:

user_salary = int(input("Please Enter Your Salary : "))

if user_salary in range(10000, 20000):

   print("Tax = ",int(user_salary/100*1))

elif user_salary in range(20000, 30000):

   print("Tax = ",int(user_salary/100*2))

elif user_salary in range(30000, 40000):

   print("Tax = ",int(user_salary/100*3))

else:

   print("No Tax!")

Explanation:

8 0
2 years ago
You can put a small level on your camera to help keep the horizons straight? TRUE OR FALSE
anastassius [24]
The answer is true and i believe it is best to put it at the 4 intersecting points<span />
5 0
3 years ago
Read 2 more answers
What are the benefits of open source software? Risks?
andrezito [222]

Answer:

more security

fewer bugs and faster fixes

no upgrade pushes

low coast

excellent support

as far as the risk part of it. I think that would be

the risk of license restriction, infringement.

5 0
3 years ago
Other questions:
  • Are there any tips or helpful advice for people who want to learn Photoshop?
    10·1 answer
  • Which button is used to open the Start menu in Windows Vista?
    14·1 answer
  • Do {
    12·1 answer
  • People are able to predict future events to some extent because: (Select all that apply)
    11·1 answer
  • Who predicted nearly 60 years ago that the rise of electronic media would create a "global village," thereby reducing the barrie
    12·1 answer
  • Out of a list of the values 8, 3, 30, 5, 15, and 6, what result would the MIN function return?
    9·2 answers
  • If a variable uses more than one byte of memory, for pointer purposes its address is: Group of answer choices the address of the
    12·1 answer
  • Javier is asked to explain to IT management as to why he is suggesting replacing the existing company firewall. Javier states th
    11·1 answer
  • How to make a computer
    14·2 answers
  • Which of the following will Excel recognize as a date?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!