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 


My First 2 programs in C++
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Losplagos
Expert Cheater
Reputation: 0

Joined: 21 Mar 2006
Posts: 172
Location: Knee deep in a c++ book

PostPosted: Thu Sep 06, 2007 12:02 pm    Post subject: Reply with quote

Yawns you did better than i did on my first program.
I am working on a verision of this i will post it up when im done.

_________________

Earthbound = 31337
Back to top
View user's profile Send private message
DoomsDay
Grandmaster Cheater
Reputation: 0

Joined: 06 Jan 2007
Posts: 768
Location: %HomePath%

PostPosted: Thu Sep 06, 2007 12:44 pm    Post subject: Reply with quote

I did not read through the source, but:
Quote:
>FtoCConvertor.exe
Celsiuse to Fahrenait (40) >> 104
Fahrenait to Celsiuse (104) >> 46.4
Back to top
View user's profile Send private message
Losplagos
Expert Cheater
Reputation: 0

Joined: 21 Mar 2006
Posts: 172
Location: Knee deep in a c++ book

PostPosted: Thu Sep 06, 2007 4:49 pm    Post subject: Reply with quote

Ok here it is. The best i could make it in my free time.
Code:
/* 09/7/07
   Made by losplagos
   Please do not give this out without my permission */
#include <iostream>
class CON // I like classes
{
     public: //just easyer  for me to make the functions public
            CON(){}; // My constructor
            ~CON(){}; // My destructor
            void cKilometersMiles(); // Declaring my functions
            void cFahrenheitCelsius();
     private:
             void cMiles(); // im keeping these private so only members of the class can access them.
             void cKilometers();
             void cFahrenheit();
             void cCelsius();
            double *cKm;
            double *conKm;
            int control;
};

void CON::cKilometersMiles()
{
     std::cout << "Enter 1 to Convert Kilometers to miles and 2 to Conver miles to kilometers" << std::endl;
     std::cin >> control;
     switch(control)
     {
                    case 1:
                         cKilometers();
                         break;
                    case 2:
                         cMiles();
                         break;
                    default:
                            std::cout << "Invalid input" << std::endl;
                            break;
     }
     control = 0;
}

void CON::cFahrenheitCelsius()
{
                        std::cout << "Enter 1 to Convert Fahrenheit to celsius  and 2 to Conver  celsius to Fahrenheit" << std::endl;
                        std::cin >> control;
                        switch(control)
                        {
                                       case 1:
                                            cFahrenheit();
                                            break;
                                       case 2:
                                            cCelsius();
                                            break;
                                       default:
                                               std::cout << "Invalid input" << std::endl;
                                               break;
                        }
                        control = 0;
}

void CON::cMiles()
{
           conKm = new double;
           cKm = new double;
           *conKm = 1.61;
           std::cout << "Enter number of miles: ";
           std::cin >> *cKm;
           *cKm = *conKm * *cKm;
           std::cout << "Answer is " << *cKm << " Kilometers" << std::endl;
           delete conKm; // Saving memory by deleting i could do this in cKilometers
           delete cKm;
           conKm=0; // setting the address to 0 so it wont be a wild / stray pointer
           cKm=0;
           
}         

void CON::cKilometers()
{
           conKm = new double;
           cKm = new double;
           *conKm = .62;
           std::cout << "Enter number of KiloMeters: ";
           std::cin >> *cKm;
           *cKm = *conKm * *cKm;
           std::cout << "Answer is " << *cKm << " Miles" << std::endl;
           delete conKm; // Saving memory by deleting
           delete cKm;
           conKm=0; // setting the address to 0 so it wont be a wild / stray pointer
           cKm=0;
}

void CON::cCelsius()
{
           conKm = new double;
           cKm = new double;
           *conKm = 1.8;
           std::cout << "Enter number in Celsius: ";
           std::cin >> *cKm;
           *cKm = (*conKm * *cKm)+32;
           std::cout << "Answer is " << *cKm << " Degrees Fahrenheit" << std::endl;
           delete conKm; // Saving memory by deleting i could do this in cKilometers
           delete cKm;
           conKm=0; // setting the address to 0 so it wont be a wild / stray pointer
           cKm=0;
}       

void CON::cFahrenheit()
{
           conKm = new double;
           cKm = new double;
           *conKm = 1.8;
           std::cout << "Enter number in Fahrenheit: ";
           std::cin >> *cKm;
           *cKm = (*cKm - 32)* *conKm;
           std::cout << "Answer is " << *cKm << " Degrees celsius" << std::endl;
           delete conKm; // Saving memory by deleting i could do this in cKilometers
           delete cKm;
           conKm=0; // setting the address to 0 so it wont be a wild / stray pointer
           cKm=0;


int main()
{
    int *si = new int;
    CON *D= new CON;
    int quit = 1;
    do
    {
           std::cout << " Enter 0 to quit, 1 to mess with distances and 2 to mess with tempatures"<< std::endl;
           std::cin >> *si;
           switch(*si)
           {
                      case 0:
                           quit = 0;
                           break;
                      case 1:
                           D->cKilometersMiles();
                           break;
                      case 2:
                           D->cFahrenheitCelsius();
                           break;
                      default:
                              std::cout << "ERROR INVALID INPUT";
           }
    } while (quit==1);
    delete si;
    delete D;
    quit = 0;
    si = 0;
    D = 0;
}   



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.


_________________

Earthbound = 31337
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
Goto page Previous  1, 2
Page 2 of 2

 
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