sales receipt help

#include <iostream>
#include <iomanip>

using namespace std;


int numb;
int word=1+0;
int cost;



int main()
{

char item[20];


cout<<"Welcome to the new new and approved Sales Receipt system"<<endl;
cout<<"This new system will not only calculate multiple sales item"<<endl;
cout<<"It will also store the name of the sale item"<<endl;
cout<<"Enjoy the new system!!!"<<endl;

std::cout<<"\n\n\n\n\n";

cout<<"Enter in the number of sales items to be calculated :"<<endl;
cin>>numb;

std::cout<<"\n";

cout<<"Enter in the name of sales item " << word <<endl;
cin>>item;

std::cout<<"\n";

cout<<"Enter in the price of the " << item <<endl;
cin>>cost;

std::cout<<"\n";

cout<<"Enter in the name of sales item " << word <<endl;
cin>>item;

std::cout<<"\n";

cout<<"Enter in the price of the " << item <<endl;
cin>>cost;





















return 0;
}

I cant seem to get the number to keep going up after I type in one set of sales, and i need to get the grand total and sales tax and store the type of info i have down already. this is as far as i can get.
Last edited on
Please use coding tags (http://www.cplusplus.com/articles/jEywvCM9/), it helps the reader.

First of all you need to be using a for loop (or even a while loop if you're fancy, but really for loops are better) if you want to work with variable amounts of input like this.

You seem to have only one variable, namely, item[20].
You will need at least two more vectors (if you know about them). One that would hold the name and the other that would hold the performances and two temporary variables.

If you can't use vectors then you have to use pointers (eg. char* name_of_iterm[const numb];)
-> I think that's how you are supposed to do it using only arrays, please correct me if I'm wrong..


Last edited on
Topic archived. No new replies allowed.