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 


C++ Problem

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

Joined: 20 Aug 2007
Posts: 558

PostPosted: Thu Oct 25, 2007 5:46 pm    Post subject: C++ Problem Reply with quote

Hi everyone. i am making an age converter in c++ ( all by myself! LOL)

i was wonder whats wrong with my code. im getting error for int b as
undeclared identifier. how do i link int b to cout << "Your Age:"
ty


#include <iostream>
using namespace std;

[code]
int main ()

{
int a = c;
int c = a * 7;


cin >> "Enter your age";
cout << " Your age:";


return 0;
}
Back to top
View user's profile Send private message
Hackerdevelopment
Advanced Cheater
Reputation: 0

Joined: 11 Oct 2007
Posts: 55

PostPosted: Thu Oct 25, 2007 5:49 pm    Post subject: Reply with quote

You have to declare if its like a floating point,integer or text.
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Oct 25, 2007 5:52 pm    Post subject: Reply with quote

#include <iostream>
using namespace std;

int main ()
{
int a;
int c ;

cout << "Enter your age: ";
cin >> a;
c = a* 7;
cout << " Your age:" c;

cin.ignore();
cin.get();
return 0;
}


you can't cin a line. You use a cout then a cin

cin = c input , so your not inputting Enter you age: your cout'ing it (c output)

_________________


Last edited by HomerSexual on Thu Oct 25, 2007 5:55 pm; edited 3 times in total
Back to top
View user's profile Send private message
Hackerdevelopment
Advanced Cheater
Reputation: 0

Joined: 11 Oct 2007
Posts: 55

PostPosted: Thu Oct 25, 2007 5:53 pm    Post subject: Reply with quote

Wat does this do anyways?
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Oct 25, 2007 5:53 pm    Post subject: Reply with quote

looks like it takes your age * 7?

and where the fuck does b come into play?

_________________
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Thu Oct 25, 2007 5:55 pm    Post subject: Re: C++ Problem Reply with quote

Do you want to convert the age of a dog to the age of a human? (Judging by the coding you have done, that is what I think.)

Code:
#include <iostream>

int main ()
{
    int b = 0;
    std::cout << "Enter the dogs age: ";
    std::cin >> b;
    std::cout << "Age in human years: " << (b * 7) << std::endl;
    std::cin.ignore();
    std::cin.get();
    return 0;
}
Back to top
View user's profile Send private message
MegaForum
Grandmaster Cheater
Reputation: 0

Joined: 20 Aug 2007
Posts: 558

PostPosted: Thu Oct 25, 2007 6:03 pm    Post subject: Re: C++ Problem Reply with quote

Flyte wrote:
Do you want to convert the age of a dog to the age of a human? (Judging by the coding you have done, that is what I think.)

Code:
#include <iostream>

int main ()
{
    int b = 0;
    std::cout << "Enter the dogs age: ";
    std::cin >> b;
    std::cout << "Age in human years: " << (b * 7) << std::endl;
    std::cin.ignore();
    std::cin.get();
    return 0;
}


lolz yes Razz human age to dog age xD
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Thu Oct 25, 2007 9:23 pm    Post subject: Reply with quote

Many pople are wrong but dogs life are like this:
First year: 12 years of dogs.
Secnd year: 12 years of dogs.
Rest are 4 years.
3 years old dog is 28. (2 times 12 = 24+4 = 2Cool - 4 years are 32 and so on...
Back to top
View user's profile Send private message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Fri Oct 26, 2007 6:04 am    Post subject: Reply with quote

Code:
#include <iostream>

int main(int argc, char **argv)
{
   int age;

   std::cout << "Enter a number: ";
   while( !(std::cin >> age) ) {
      std::cout << "Enter a NUMBER ffs: ";
      std::cin.sync(); // Sync the stream
      std::cin.clear(); // Clear the bit
   }

   std::cout << "The number multiplied by seven: " << age*7 << std::endl;

   std::cin.ignore(); // Ignore the input (pause the proggie)
   std::cin.sync(); // and discard the input

   return 0;
}
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