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 


erm, need source code help [c++ begginer stuff]

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

Joined: 25 Nov 2007
Posts: 170

PostPosted: Wed Nov 28, 2007 5:34 am    Post subject: erm, need source code help [c++ begginer stuff] Reply with quote

im trying to make a multiplying calculator trought a simple cmd code, but when i tryed compiling it.... 15 errors Shocked

heres the source code

typedef unsigned short USHORT
#include <iostream.h>
using namespace std ;
USHORT FindProduct(USHORT OneToWrigth, USHORT Multy);

int main()
{
USHORT Product;
USHORT Multy;
USHORT OneToWrigt;

cout << "Insert number to multiply: ";
cin >> OneToWrigt;
cout << "Number multiplyed by? ";
cin >> Multy;

Product = FindProduct(OneToWrigt,Multy);

cout << "\nThe number is: ;
cout << Product;
return 0;
}

USHORT FindProduct(USHORT w, USHORT m);
{
return w * m;
}

Confused Confused Confused

can someone tell me waths wrong in the script?


Last edited by Engineer on Wed Nov 28, 2007 6:23 am; edited 1 time in total
Back to top
View user's profile Send private message
Aikos
Cheater
Reputation: 0

Joined: 26 Nov 2007
Posts: 47

PostPosted: Wed Nov 28, 2007 5:50 am    Post subject: Reply with quote

1. missing semicolons in a number of places
2. I guess you need "using namespace std;" before your code in order to use cin/cout without adding std:: before the functions.
Back to top
View user's profile Send private message
Engineer
Expert Cheater
Reputation: 1

Joined: 25 Nov 2007
Posts: 170

PostPosted: Wed Nov 28, 2007 6:02 am    Post subject: Reply with quote

dangit those semicolons Evil or Very Mad
editing it later, gotta eat now, thanks ill say if i get more errors

EDIT i added semicolons and namespace std and i even got more errors!!!!
(editing the 1st post for the actual code)
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Nov 28, 2007 6:48 am    Post subject: Reply with quote

Code:

#include <iostream>

unsigned short FindProduct(unsigned short OneW, unsigned short Multy)
{
   return (OneW * Multy);
}

int main(int argc, char* argv[])
{
    unsigned short product, Multy, OneW;

    std::cout << "Insert number to multiply: ";
    std::cin >> OneW;
    std::cout << "Multiplied by? ";
    std::cin >> Multy;

    product = FindProduct(OneW, Multy);

    std::cout << std::endl << "The product is:" << std::ends << product;

    return 0;
}

_________________
Back to top
View user's profile Send private message
Engineer
Expert Cheater
Reputation: 1

Joined: 25 Nov 2007
Posts: 170

PostPosted: Wed Nov 28, 2007 7:21 am    Post subject: Reply with quote

thanks, it dosnt has any error, but it after Multy is defined it shuts down Crying or Very sad
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Nov 28, 2007 7:22 am    Post subject: Reply with quote

add

Code:

std::cin.get();
std::cin.sync();


before

Code:

return 0;

_________________
Back to top
View user's profile Send private message
Engineer
Expert Cheater
Reputation: 1

Joined: 25 Nov 2007
Posts: 170

PostPosted: Wed Nov 28, 2007 7:27 am    Post subject: Reply with quote

still closes Confused
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Wed Nov 28, 2007 7:33 am    Post subject: Reply with quote

run the program from the command line

or use an IDE that automatically pauses the console for you, like MSVC or Code::Blocks

_________________
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