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 


Practicing/Showing off my C++ skills

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

Joined: 17 Feb 2007
Posts: 199

PostPosted: Sat Apr 05, 2008 6:58 pm    Post subject: Practicing/Showing off my C++ skills Reply with quote

hey guys here are some of my c++ projects after 2 days of learning......i got amost all of it from a tutorial and stuff but i actually know wat it means and stuff now.......this is here just to prove that ppl like me who always used to leech stuff are actually trying to learn now...i am NOT going to give up and just take a look at it before this topic gets moved Smile

i know this is pure randomness so meh w/e deal w/ it

Code:
#include<iostream>
using namespace std;

int main()
{
      cout << "This is my program " << endl;
      system("pause");
      return 0;
}


and a longer one

Code:
#include<iostream>
using namespace std;

int main(void)
{
   
    system("TITLE Travis' Calculator");
    system("COLOR 4F");
    char cChar;
    double dfirstnumber;
    double dsecondnumber;
    char cDoagain;
   
do
{
    system("CLS");
    cout << "please enter the first number that you would like to use" << endl;
    cin >> dfirstnumber;
    cout << "please enter the operation that you would like to complete" << " (+,-,* or /)" << endl;
    cin >> cChar;
   
    cout << "please enter the second number you would like to use" << endl;
    cin >> dsecondnumber;
   
    switch (cChar)
    {
    case '+':
           cout << "The answer is: " << dfirstnumber << " + " << dsecondnumber << " = " << (dfirstnumber + dsecondnumber) << endl;
           break;
    case '-':
           cout << "The answer is: " << dfirstnumber << " - " << dsecondnumber << " = " << (dfirstnumber - dsecondnumber) << endl;
           break;
    case '*':
           cout << "The answer is: " << dfirstnumber << " * " << dsecondnumber << " = " << (dfirstnumber * dsecondnumber) << endl;       
           break;
    case 'x':
           cout << "The answer is: " << dfirstnumber << " x " << dsecondnumber << " = " << (dfirstnumber * dsecondnumber) << endl;
           break;
    case 'X':
           cout << "The answer is: " << dfirstnumber << " X " << dsecondnumber << " = " << (dfirstnumber * dsecondnumber) << endl;
           break;
    case '/':
         if(dsecondnumber == 0){
         cout << "That is an invalid operation" << endl;
         }else{
         cout << "The answer is: " << dfirstnumber << " + " << dsecondnumber << " = " << (dfirstnumber + dsecondnumber) << endl;
         }
         break;
    default:
         cout << "That is an invalid operation" << endl;
         break;
         }
         cout << "Would you like to start again? (y or n)" << endl;
         cin >> cDoagain;
         }while (cDoagain == 'Y' || cDoagain == 'y');
         system ("PAUSE");
         return 0;
}
Back to top
View user's profile Send private message MSN Messenger
Karakawe
I post too much
Reputation: 3

Joined: 17 Apr 2007
Posts: 3899

PostPosted: Sat Apr 05, 2008 7:10 pm    Post subject: Reply with quote

Have you tried to compile this?
Borland gives two errors :
1. Line 2 - Namespace name expected
2. Line 7 - Call to undefined function 'system' in function main()
Now fix it! Twisted Evil

And keep up the good work.
C++ wins. Very Happy
Back to top
View user's profile Send private message
Travis13
Expert Cheater
Reputation: 0

Joined: 17 Feb 2007
Posts: 199

PostPosted: Sat Apr 05, 2008 7:14 pm    Post subject: Reply with quote

lol thanks for replying....and yes i have compiled it with dev-c++............GREAT program i like it lots, i would use visual c++ from microsoft but my computer gets an error trying to install .net 3.5 framework (NO CLUE WHY IF U KNOW WHY TELL ME ANYONE Razz)

anyways yeah i got no errors...after fixing it a million times and its in an exe now and it works great Smile

btw ppl if u need good tutorials on learning c++ heres a good guy on youtube that gives good tutorials.....DONT RUSH THROUGH THEM....understand EVERYTHING before u go on to video 2 et cetra.

http://youtube.com/watch?v=nziy2_U5JQI
Back to top
View user's profile Send private message MSN Messenger
Karakawe
I post too much
Reputation: 3

Joined: 17 Apr 2007
Posts: 3899

PostPosted: Sat Apr 05, 2008 7:15 pm    Post subject: Reply with quote

Okay, might be slight differences between the compilers.
I used to use dev-cpp. Nice program.
Edit: Their site is this?


Last edited by Karakawe on Sat Apr 05, 2008 7:17 pm; edited 1 time in total
Back to top
View user's profile Send private message
Travis13
Expert Cheater
Reputation: 0

Joined: 17 Feb 2007
Posts: 199

PostPosted: Sat Apr 05, 2008 7:17 pm    Post subject: Reply with quote

yeah, anyways u know how to make a gui? i know delphi is all about buttons and functionings and everything and i have it downloaded (borland delphi 7) but how how do u use it with c++ compiled sources?
Back to top
View user's profile Send private message MSN Messenger
Karakawe
I post too much
Reputation: 3

Joined: 17 Apr 2007
Posts: 3899

PostPosted: Sat Apr 05, 2008 7:19 pm    Post subject: Reply with quote

You've got me there. I've only really worked in depth with C++. I like controlling everything in my programs. Cool
So, I'm not really sure. You'd probably have to start getting into Delphi more to figure out how.
Back to top
View user's profile Send private message
Travis13
Expert Cheater
Reputation: 0

Joined: 17 Feb 2007
Posts: 199

PostPosted: Sat Apr 05, 2008 7:23 pm    Post subject: Reply with quote

Karakawe wrote:
You've got me there. I've only really worked in depth with C++. I like controlling everything in my programs. Cool
So, I'm not really sure. You'd probably have to start getting into Delphi more to figure out how.


well yeah if i ever wanted to release something i would want to write it in c++ but i would like some kind of design to it, not just a black box or maybe change the colour of foreground and backround.....meh ill search around

p.s. trade rep? Smile
Back to top
View user's profile Send private message MSN Messenger
sinsgift
Cheater
Reputation: -1

Joined: 16 Aug 2007
Posts: 43
Location: behind you

PostPosted: Sat Apr 05, 2008 7:58 pm    Post subject: Reply with quote

wrong section
_________________
Watch out im out to get you...

Back to top
View user's profile Send private message
Drops
Advanced Cheater
Reputation: 0

Joined: 22 Feb 2008
Posts: 62

PostPosted: Sat Apr 05, 2008 8:03 pm    Post subject: Reply with quote

I wouldn't use anything from system...I remember when I was learning the basics people were scolded for using that...especially to just pause the program from shutting off. Use cin.ignore() and cin.get().
Back to top
View user's profile Send private message
TheZaw
Valve mod
Reputation: 0

Joined: 01 Mar 2008
Posts: 1061
Location: Learning C++

PostPosted: Sat Apr 05, 2008 8:21 pm    Post subject: Reply with quote

Heya, im learning C++ too! Compile this! fully commented and stuff, not complete yet. Gotta finish the math part of it.

Code:
#include <iostream>
using namespace std;

int   goal, current, buy, sell;//declaring integers for use

int profitper, profit, d, e, f; //integers used in the math part
int itemsper;
int remainder;//these integers will be thrown away later, just needed to store temporary values
 

int main(){//main part of program


                  cout<<"Enter current money available for merchenting: ";
                  cin>>current;//gets current money for merchenting. Cout stands for console (keyboard) out. Cin stands for console in.
                  cin.ignore();//ignores enter, so cin.get doesn't trigger.

                  cout<<"Enter goal for total cash at end of merchenting: ";
                  cin>>goal;//Gets Goal for cash
                  cin.get();
                 
                  sorry4screweingGoodPractice://C++ "joke"
                 
                  cout<<"How much are you buying the item for: ";
                  cin>>buy;//gets how much to buy item for
                  cin.get();

                  cout<<"How much are you going to sell the item for: ";
                  cin>>sell;
                  cin.ignore();

                  if(buy>sell){
                               goto sorry4screweingGoodPractice;
                               }               
                                                           
                                           
                 

while (current<goal);{//while current money is less than goal do this
       profitper=sell-buy;//gets profit per item
     
      itemsper=current/buy;
     
      remainder=current%buy;//the "%" operator returns the remainder of the divisor
                         if(remainder){
                                   current=current+1;
                                   }
     
      profit=profitper*itemsper;
 

      cout<<"lol";
}
cout<<"Test";
    cin.get();//when finished, press enter to terminate program
}

_________________
Back to top
View user's profile Send private message MSN Messenger
Chaosis13
Master Cheater
Reputation: 0

Joined: 14 Aug 2007
Posts: 372

PostPosted: Mon Apr 07, 2008 4:43 pm    Post subject: Reply with quote

lol... Sorry, I had to say it.

I just hope you stay dedicated(after 2 days), we need more C++ coders.
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Mon Apr 07, 2008 5:23 pm    Post subject: Reply with quote

Don't use system("pause").
_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Mon Apr 07, 2008 6:40 pm    Post subject: Reply with quote

Coding GUIs eh.. well that will be in the far future. Focus now on pointers/arrays/classes/objects and master those completely on console apps. Then start to learn the Windows API and how to code GUIs from there. I know its tempting to build a bot, we all feel it, but its much better when you code it efficiently and when you know EVERYTHING about what you are doing.
Back to top
View user's profile Send private message AIM Address
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Mon Apr 07, 2008 11:37 pm    Post subject: Reply with quote

is it natrual that everyone's making a calculater as their 2nd or 3rd program in C/++ ? because i see everyone's doing it (even i did lol)
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Apr 08, 2008 3:46 am    Post subject: Reply with quote

Code:
goto sorry4screweingGoodPractice;


Not bad practice if you use it right.
Back to top
View user's profile Send private message 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