Hi im trying to design a looping swicth statement for my project. Basicly it ask a person to enter either A B C D or T T ends the loop. Then it should add up all of the items entered and give a grand total of the cost. However I am sort of new to programing, and have no idea how to finish my Code. I have attached what I have so far any ideas or corrections would be much appreicated.
// Lab 3 week 8 Created by David Warner on 2/28/11
#include <iostream>
using namespace std;
int main( )
{
int price = 0;
char item = '';
double totalcost = 0.0;
I think what you want is to add each price to totalcost each time they order one, not assume they ordered one of each (the syntax there is invalid anyway).
Well now, I'm not going to do it for you. The rest of your code looks perfectly fine, which means one of two things:
* You are lazy, and don't want to make a few small changes
* You copied this code from somewhere and did a bit of editing, but have no idea what you are doing
I find it hard to believe you can make a switch statement but can't add some variables together.
At present, more and much more people decide on online buying.[url=http://www.nhljerseysshop.com] nhl jerseys [/url] Just while it’s appoint implies, online authentic Reebok jerseys shopping should be to conduct the actual shopping programs online. A very important reason to get online shopping is it delivers convenience into the life associated with people.
its my code its part of my homework a lot of times we start with a single code that is simple then each progresive question adds another thing to do it. Im just asking when you say add price. Do you mean price each one out seperatly as an interger?
1.)You need a default case for when a suitable case is not entered by the user
2.) How are you going to strip the price out of each case string?
3.) As Zhuge says you need to keep track of the running total with something like
totalcost+= item;