im a newbie.pls guide me

how can i output the value k from the input string day?and is it correct the declaration of string day?;P

int k;
string day;

{
cout<<"enter day: "<<endl;
cin>>day;
string days[k]=day;
}
I don't understand your question or code. Is there something your trying to do?
how can i output the value k from the input string day

You never give k a value. If you want to output a single char from the string that's something different.

What is string days? looks like an array, but you can't define an array with a variable length such as k. If k is suppose to be constant you need to have a keyword const in front of it.

string day; // This declares a std::string called day. Just like int k, makes an integer k.
i know. i dont even understand it myself. hahhaaaa. let me refer it from the book first. but thanks for the reply
Topic archived. No new replies allowed.