HELPP

so my program does not stop for the cin's can anyone tell me why


cout << "enter the amount sperate items you wish you order" <<endl;
cin >>X;

cout <<"please enter art code" <<endl;
cin >> artcode1;
cout <<"enter the amount you wish to order" <<endl;
cin >>qty1;


if (X>1)
{
cout <<"please enter art code" <<endl;
cin>>artcode1;
cout <<"enter the amount you wish to order" <<endl;
cin >>qty2;
}
can you please use the code function it looks a lot better.

also as for your problem do you mean it doesn't record them, or it skips that step and wont even let you enter them?
Last edited on
I wrote a code to record and print out the data, in the process,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
using namespace std;

int main(){
    int x, n=0, artqty[n];
    int artcode[n];
    
    cout << "enter the amount sperate items you wish you order" <<endl;
    cin >>x;

    while (n < x)
    {
       cout <<"please enter art code" <<endl;
       cin >> artcode[n];
       cout <<"enter the amount you wish to order" <<endl;    
       cin >> artqty[n] ;
       n++;
       };
    
    for( n = 0; n<x; n++ ){
         cout << "artcode : " << artcode[n] <<"  quantity" << artcode[n] << endl;
         } 
    
    system("pause");
    return 0;
}


But if i change the artcode[n] into string type, the program seem to be unresponsive, anyone know why? Is it because the size of string is undefined and error occur when the array size increase?
Last edited on
Topic archived. No new replies allowed.