RE: [Dev-C++] I am new to C ++ and need some help
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <pra...@ya...> - 2000-12-11 09:50:28
|
hey u used the wrong logic!
you cannot use the statement
if(char c=='bruce')
{cout<<"Thankk You";
you will have to use the following commands:-
#include<string>
char c[25];
cout<<"enter your name";
if(strcmp(c,"bruce")==0)
cout<<"Thank You";
else
cout<<"You are not granted access";
exit(0);
}
--- Bruce Young <y2...@ho...> wrote:
<HR>
<html><DIV>
<P>be sure to include the: #include
<string></P>
<P><BR>#include <iostream.h><BR>#include
<stdlib.h><BR>#include <string></P>
<P>int main()<BR>{<BR> string
name;</P>
<P> do<BR> { cout <<
"\nPlease enter your name:
";<BR> cin >>
name;</P>
<P> cout <<
"\nName = " << name << endl;</P>
<P> if (name == "John"
|| name ==
"john")<BR>
cout << "\nThank
you!!\n";<BR>
else<BR>
cout << "\nNo. Try again";</P>
<P> }<BR> while(name != "John" ||
name != "john");</P>
<P> </P>
<P>
system("PAUSE");<BR>
return 0;<BR>}</P></DIV><br clear=all><hr>Get more
from the Web. FREE MSN Explorer download : <a
href="http://explorer.msn.com">http://explorer.msn.com</a><br></p></html>
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/
|