i have jut started learning cpp need help :

is their any way i can make a char statement conatining spaces too.
if yes plz tell me.
:rolleyes:

Recommended Answers

All 11 Replies

i got tc.exe

is their any way i can make a char statement conatining spaces too.

What question are you trying to ask? The best I can manage is, "How can a read a line of text containing whitespace from the user?" If so, my next question would be, C or C++?

I think s/he is trying to declare a variable "char" to values seperated by spaces. If so, you can simply do this:

char a[] = "Blue Moon";

Just replace "a" with the variable you want to use, and replace the words in quotation marks with your own statement. Hope this helps.

i accually need help wwith this programm
here i want help so that any amount of words can be filled in the address

# include <iostream.h>
# include <conio.h>

void main()
{
	clrscr();
	char address[60];

	cout<<"Enter your address";
	cin>>address;
	cout<<"Your address is "<<address;
	getch();

}

<< moderator edit: added code tags: [code][/code] >>

Look up getline -- cin is whitespace delimited.

im relly a noob i dont know anything i just started learning c++
can u help me by editing my above program .

I edited your code, good for tc only...

# include <iostream.h>
# include <conio.h>

void main()
{
clrscr();
char address[60];

cout<<"Enter your address";
cin.getline(address,60,'\n');
cout<<"Your address is "<<address;
getch();

}

simple examlpe of getline:

char input[55];
    cin.getline(input,55);

its showing a error

unable to open file "c0s.obj"

wut does it mean :eek:

It's trying to tell you to replace your old ass compiler with something that conforms to the C++ standard. Let me guess, your operating system is Windows XP, right?

>unable to open file "c0s.obj"
Go to Options, Directories and make sure that you see something like this sitting around there: c:\<wherever you installed it>\lib

THANK YOU Everyone for your suppeort
when i tried the same thing today it was not showing the error (hmmm.......)

THANKS:-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.