SOLVED!!!!
im making a simple program that first asks the user for the number of items. "items" is the size of an array. and then after that the program should ask the user for the value of however many items he entered
Code:
#include <iostream>
using namespace std;
int main(){
int NumberOfItems;
int Items[NumberOfItems];
cout<<"enter number of items\n";
cin>>NumberOfItems;
cin.get();
for (int i = 0;i < NumberOfItems;++i){
cout<<"item"<<i = i + 1<<":" <<Items[i]<<"\n";
cin<<Items[i];
};
cin.get();
};
thats the code
SOLVED:i overcomplicated the code a bit.. i didnt even need <<Items[i]<< in the for statement. same thing with i = i + 1.
heres my new code
Code:
#include <iostream>
using namespace std;
int main(){
int NumberOfItems;
int Items[NumberOfItems];
cout<<"enter number of items\n";
cin>>NumberOfItems;
cin.get();
for (int i = 0;i < NumberOfItems; ++i){
cout<<"item"<<i + 1<<":\n";
cin>>Items[i];
cin.get();
};
cin.get();
};
still going to be doing a bit more array work