yes i did searhc the posts and looked on the internet. but is there a c++ varible that can hold data that is more than one line?
yes i did searhc the posts and looked on the internet. but is there a c++ varible that can hold data that is more than one line?
What do you mean by data which is on more than one line?
Do you mean a structure, like:
TPoint p;
p.x = 20;
p.y = 20;
ok i am making a game.... i need this to be a varible
and i have 4 other like it with different ascii arts next to the menu, btu it takes 17 lines, i need each menu make to be a variblecout << "&&&&&&&&&&&-MENU-&&&&&&&&&&&&&& *"<<endl;
cout << "& & **"<<endl;
cout << "& 1. Resume Game & ****"<<endl;
cout << "& & **** *******"<<endl;
cout << "& & * * *********"<<endl;
cout << "& 2. Save Game & * * *************"<<endl;
cout << "& & **** *****************"<<endl;
cout << "& & ** ##############"<<endl;
cout << "& 3. View Status & ** #### ## ####"<<endl;
cout << "& & ** ##### ## #####"<<endl;
cout << "& & ** ##### ## #####"<<endl;
cout << "& 4. View Map & ** ################"<<endl;
cout << "& & ** ##############"<<endl;
cout << "& & ** ############"<<endl;
cout << "& 5. Go to Main Screen & ** %%%%%%%%%%%%%%%%%%%"<<endl;
cout << "& & ** %%%%%%%%%%%%%%%%%%%%%"<<endl;
cout << "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ** %%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
----
edit
----
the thing is kinda deformed, if u compile it it might come out irght its supposed to be a menu (just ext) next to a character.
on ur structure
TPoint p;
p.x = 20;
p.y = 20;
could i do like
p.a = first line of menu
p.b = second line of menu
and so fourth and the varible would be p?
Are you sure you don't want to make it a function?
-Govtcheez
[email protected]
uh i dont know about functions yet
would my way work i just asked about
Data that is more than one line? All strings can be variables. And so can this:
char something[34]="First line\nSecond line\nThird line";
I am not using Dev-C++.
#!/usr/bin/env python
import sys;file=open(sys.argv[0]);print file.read();file.close()
oh those are functions, i know abotu that crap, i wasnt htinking
char something[17]="First line\n, Second line\n, Third line";
isnt it like that tho?
> oh those are functions, i know abotu that crap, i wasnt htinking
No, those are strings (well, char arrays, whatever)
> isnt it like that tho?
No - you don't enough space.
-Govtcheez
[email protected]
wel here was the resualt
i cant use the char varible or any other arible i could htink of or find, wut vairble type should i useCode:char mage[17] ="&&&&&&&&&&&-MENU-&&&&&&&&&&&&&& *\n& & **\n& 1. Resume Game & ****\n& & **** *******\n& & * * *********\n& 2. Save Game & * * *************\n& & **** *****************\n& & ** ##############\n& 3. View Status & ** #### ## ####\n& & ** ##### ## #####\n& & ** ##### ## #####\n& 4. View Map & ** ################\n& & ** ##############\n& & ** ############\n& 5. Go to Main Screen & ** %%%%%%%%%%%%%%%%%%%\n& & ** %%%%%%%%%%%%%%%%%%%%%\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ** %%%%%%%%%%%%%%%%%%%%%%%%\n";
note u gotta scroll to the right
Wow... no.
First - your char array only has space for 17 characters - you have a few more than that.
Second - use a function. Seriously - read about it. Learn about them - you can't write anything of decent length without functions.
-Govtcheez
[email protected]
You can solve both the length problem (by letting the compiler count the chars for you), and the formatting problem like so
Code:char mage[] = "&&&&&&&&&&&-MENU-&&&&&&&&&&&&&& *\n" "& & *\n" "& 1. Resume Game & ****\n" "& &";
thanks salem
what would ever be the point in counting characters fi the ocmpiler can count for you?
Because sometimes you can't initialize the char array when it's created, and user input is needed.