creating variables on the fly
ok, so i need to have identical structures or classes (doesn't matter), and i need to have as many of them as the user wants to use. i could make a whole bunch of htem and call it good, but there is always that chance. so i want to have a counter, that creates a structure to put information to as its needed. but i keep getting really really weird syntax errors.
first, is that posible?
second, i created a dummy program just to see if it was posible, this is it, and this is whats giving me so much trouble.
Code:
#include <iostream>
void main()
{
int n = 0;
int again;
do{
struct n
{
int i;
}n;
cout << "gimmie a number: ";
cin >> n.i ;
cout << "go again? 1/0: " ;
cin >> again ;
n++;
}while( again == '1');
while( n >= '0')
{
cout << "n.i" ;
}
return;
}
the errors that i get don't make sence, and when i double cliock on them it opens up 2 new files, cerrno, and cstdio, and says something is wrong with them.
any idea what i'm doing wrong/ any idea how to do what i'm trying to do?
any help is greatly apreciated :)
ps: i'm using windows XP, with microsoft visual studio.net