Hi people...
I'm still new in c++..
I got the problem with the recent assignment
that i have to do...
This is the assignment that i got...
[ATTACH]12228[/ATTACH]
my problem is i dont know how to display all the value that the user entered into a single receipt...when i tried to run my program,its only could display the last value entered by user...After i figured out..i know that i suppose to stored those values in the array..but the problem is i still dont know how to display all the data that stored in the array that I have declared...This is my attempt..
#include <iostream>
#include <iomanip>
using namespace std;
int Id,price,quantity,items,sale;
int no;
string name;
//FUNCTION PROTOTYPE
void ENTER();
void ENTER1 ();
int display();
int add_item();
int main ()
{
cout<<"------------------------PROGRAM 2 PROJECT [CASH RECEIPT]------------------------"<<endl;
ENTER();
cout<<endl;
cin.get();
return 0;
}
void ENTER ()
{
cout<<"Enter the Product ID :";
cin>>Id;
cout<<"Enter the Product Name :";
cin>>name;
cout<<"Enter the Price For Single Item :";
cin>>price;
cout<<"Enter The Quantity :";
cin>>quantity;
cout<<endl;
add_item();
}
int Id1;
string name1;
int price1,quantity1;
void ENTER1 ()
{
cout<<"Enter the Product ID :";
cin>>Id1;
cout<<"Enter the Product Name :";
cin>>name1;
cout<<"Enter the Price For Single Item :";
cin>>price1;
cout<<"Enter The Quantity :";
cin>>quantity1;
cout<<endl;
add_item();
}
int display ()
{
cout<<Id<<setw(10)<<name<<setw(10)<<price<<setw(10)<<quantity<<endl;
cout<<Id1<<setw(10)<<name1<<setw(10)<<price1<<setw(10)<<quantity1;
}
int add_item()
{
char add;
cout<<"Add Another Item (y/n) :";
cin>>add;
cout<<endl;
switch (add){
case 'y' :
ENTER1 ();
break;
case 'n' :
display();
break;
}
}