Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <stdlib.h>
- #include <fstream>
- using namespace std;
- struct newproduct
- {
- string name;
- double price;
- int stock;
- int sold;
- };
- int main()
- {
- newproduct prod[200][200];
- int no1, no2;
- string productname;
- int i;
- int j;
- char ch;
- cout<< "How many products?"<<endl;
- cin>>no1;
- for(i=0; i<no1; i++)
- {
- cout<< "Product "<<i+1<<":";
- cin>> productname;
- cout<< "How many of product "<<productname<<endl;
- cin>>no2;
- for(j=0; j<no2; j++)
- {
- cout<<"Name: ";
- cin>>prod[i][j].name;
- cout<<"price: ";
- cin>>prod[i][j].price;
- cout<<"stock: ";
- cin>>prod[i][j].stock;
- cout<<"sold: ";
- cin>>prod[i][j].sold;
- cout<<"Name: ";
- cout<<prod[i][j].name<<endl;
- cout<<"price: ";
- cout<<prod[i][j].price<<endl;
- cout<<"stock: ";
- cout<<prod[i][j].stock<<endl;
- cout<<"sold: ";
- cout<<prod[i][j].sold<<endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement