Thanks for the info, owens. I have to admit I never used it.
I'm curios why one would still use char[] or char* then.
Thanks for the info, owens. I have to admit I never used it.
I'm curios why one would still use char[] or char* then.
omg what is so hard?
just use string!!!
#include <string>
#include <iostream>
using namespace std;
string mystring = "kostya92";
int main()
{
cout << "type something: ";
getline(cin,mystring);
if(mystring == "kostya92")
{
cout << "FIG1";
}
else
{
cout << "FIG2";
}
}
happy now??
edit: and leave this char[] or char* because its arrays and pointers you will learn it later all you need to know now its how to use this basics things i showed you.
Last edited by kostya92; 03-26-2007 at 02:48 PM.
When you're dealing with C++, you need to understand things like pointers and memory locations, and arrays (especially arrays). Just sweeping them under the floor and saying "stick to the basic stuff" isn't helping anyone learn anything.
Also, using a string isn't always the right thing to be using. Learning about char*, char[], and the string class are all beneficial.
I hope that wasn't pointed at me.Originally Posted by kostya92
nope adryan its not to you its to milwal
and owensd milwal is a beginer he no need to know about pointers and arrays right now he will learn it later after he finish the basics, do you agree with me owensd?
Pointers, probably not... however, arrays I think are fundamental to beginners so he should learn then now as they are part of the basics. Using the string class is all fine and dandy, but he's going to be seeing a lot of beginner examples that use char* and char[] and he will need to understand those in order to get the examples/tutorials.Originally Posted by kostya92