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 


Check this

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
wunder312355
Grandmaster Cheater
Reputation: -1

Joined: 14 May 2007
Posts: 568

PostPosted: Wed Jan 23, 2008 7:17 pm    Post subject: Check this Reply with quote

I cant seem to find the problem with this. What this program does, is trys to find the length of the specified word, and print it. In this case im getting an error. Any Clues?


string length.GIF
 Description:
Help
 Filesize:  63.06 KB
 Viewed:  2432 Time(s)

string length.GIF


Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Jan 23, 2008 7:49 pm    Post subject: Reply with quote

1. Why are u using void main? use int main.
2. C++ is case sensitive, you defined "Length" then u called on "length"
3. there is a header called "string" and it helps to use it cuz its got its own string length function built in, yayy

Code:
#include <iostream>
#include <string>

int stringLength(std::string str)
{
   int strLength = str.length();
   return strLength;
}

int main()
{
   int strLen = stringLength("Dan");
   std::cout << strLen;
   std::cin.sync();
   std::cin.ignore();
   return 0;
}

_________________
Back to top
View user's profile Send private message
Heartless
I post too much
Reputation: 0

Joined: 03 Dec 2006
Posts: 2436

PostPosted: Wed Jan 23, 2008 7:59 pm    Post subject: Reply with quote

remove the ';' after stringLength().
_________________
What dosen't kill you, usually does the second time.
Back to top
View user's profile Send private message
wunder312355
Grandmaster Cheater
Reputation: -1

Joined: 14 May 2007
Posts: 568

PostPosted: Wed Jan 23, 2008 8:10 pm    Post subject: Reply with quote

Okey thx. It always helps to look for dumb mistakes right? :)
Back to top
View user's profile Send private message
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