Hi,
Im fairly new with programming. Im following up my last class on programming with c++.
The question i have is very simple.
Lets say you want to create 10 different variables and give them name hello1 hello2 etc...
I want to use for(). But the problem I have is that i can't understand how you can use a variable for defining a variables name.
example:
*(this is where I want i to be, so that for() can create 10 different hello variables with the name hello0 hello1 hello2 etc...)Code:#include <iostream>
using namespace std;
int main (){
int i;
for(i = 0; i<10; i++){
char hello(i);*
cin >> hello(i);**
cin.ingore(1000, '\n');
}
//this would give us the input for our hello0 and hello5 variable.
cout << endl << endl << hello0 << hello5;
return 0;
}
**(i.... same here, each time for() goes a lap i want the next variable to be used in the cin phrase)