How to randomize new varible?
For Example:
int r;
r = random();
r will be for example 43
so I want varible array become: char hello_43[256];
Example code please...
Thanks.
How to randomize new varible?
For Example:
int r;
r = random();
r will be for example 43
so I want varible array become: char hello_43[256];
Example code please...
Thanks.
not possible.
variable names are a compile time thing. They cannot be chosen based on runtime decisions.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
You can't really do that.. unless there are preprocessor directives I'm not aware of. What reason do you have for needing this? Maybe someone can suggest an alternative route for you.
__ &n bsp; ___ & nbsp; &nb sp;   ;
/\ \ __ &nbs p; /\_ \   ; & nbsp;
\_\ \/\_\ ____ _ __\//\ \ __ __&n bsp; __
/'_` \/\ \/\_ ,`\ / __`\\ \ \ /\ \/\ \ /'__`\
/\ \_\ \ \ \/_/ /_/\ \_\ \\_\ \_\ \ \_/ |/\ __/
\ \___,_\ \_\/\____\ \____//\____\\ \___/ \ \____\
\/__,_ /\/_/\/____/\/___/ \/____/ \/__/ \/____/
&n bsp; I have a BAD figlet& nbsp;addiction.
While I don't think this is necessarily a great way to code, you could instead do 2 dimensional arrays.
Code:char hello[100][256]; int r; r = random()%100; // get number between 0 and 99 hello[r]="whatever";
Well, How can I use hello[1][256]; with cin.get()?
For example:
char wow[256];
cout <<"Enter your name\n";
cin.get(wow,256);
How would I do that if it has wow[1][256] with cin.get?
I believe like this:
Code:char wow[100][256]; cout <<"Enter your name\n"; cin.get(wow[1],256);