Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


strcmp and strcat commands?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 28, 2007 12:24 pm    Post subject: strcmp and strcat commands? Reply with quote

Code:

#include <iostream>
#include <cstring> 

using namespace std;

int main()
{
  char name[50];
  char lastname[50];
  char fullname[100];
 
  cout<<"Please enter your name: ";
  cin.getline ( name, 50 );
  if ( strcmp ( name, "Julienne" ) == 0 )
    cout<<"That's my name too.\n";
  else                                   
    cout<<"That's not my name.\n";
  cout<<"Your name is "<< strlen ( name ) <<" letters long\n";
  cout<<"Enter your last name: ";
  cin.getline ( lastname, 50 );
  fullname[0] = '\0';           
  strcat ( fullname, name );   
  strcat ( fullname, " " );     
  strcat ( fullname, lastname );
  cout<<"Your full name is "<< fullname <<"\n";
  cin.get();
}


Ok, in my tutorial in C++ we're working on strings, but, I don't get what strcat and strcmp do? I have run this program to see what it does, but I don't know why it does what it does. The website didn't really teach me what cin.getline() does. And it didn't explain WHAT strcat and strcmp does. Can someone help me with this?

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon May 28, 2007 12:57 pm    Post subject: Reply with quote

strcmp compares s2 and s1 and strcpy copies s2 to s1

Last edited by appalsap on Mon May 28, 2007 1:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 28, 2007 1:33 pm    Post subject: Reply with quote

appalsap wrote:
strcat appends s2 to s1 and strcpy copies s2 to s1


I said strcmp not strcpy...and what do you mean s2 and s1?

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
DeltaFlyer
Grandmaster Cheater
Reputation: 0

Joined: 22 Jul 2006
Posts: 666

PostPosted: Mon May 28, 2007 1:35 pm    Post subject: Reply with quote

http://www.google.com/search?q=strcmp&btnI=I%27m+Feeling+Lucky
http://www.google.com/search?q=strcat&btnI=I%27m+Feeling+Lucky
http://www.google.com/search?q=cin+getline&btnI=I%27m+Feeling+Lucky

It's really much easier to just click on the first line from a google search rather than typing up all that. You get your results instantly too instead of waiting for others.

_________________

Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for?
Back to top
View user's profile Send private message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Mon May 28, 2007 2:22 pm    Post subject: Reply with quote

Thank you!
_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites