Arrays
Mar 15, 2012 at 8:22am UTC
Good Day!!!
I am really wondering if we can reinitialize the array size during run time.
and also,
Please help about this test code. Why I am getting an error message.
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 28 29 30 31
#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include <new>
using namespace std;
int main(int argc, char *argv[])
{
int numName;
int ctr;
string * str;
cout << "How many names you want to enter: " ;
cin >> numName;
str = new (nothrow) int [numName];
for (ctr = 0; ctr < numName; ctr++)
{
cout << "Name number " << ctr << ": " ;
cin >> str[ctr];
}
system("pause" );
return 0;
}
Thanks in advance.. :)
Mar 15, 2012 at 8:48am UTC
Last edited on Mar 15, 2012 at 8:48am UTC
Mar 15, 2012 at 8:57am UTC
Thank you for everything adesh ....and also the link..it will help me a lot in using C++. I am actually doing some test programs like Phone Book. Thanks a lot once again.... :)
Topic archived. No new replies allowed.