Author | Need help with my C++ program please |
TROY Member

Posts: 83 Location: Sheffield, UK
Joined: 17.06.08 Rank: Moderate | |
First of all i just want to say im really sorry and i apolagize for these posts that i am doing, they are normally very long and probably confusing of which im really sorry, but i would really appreciate some help. Thanks, anyway.....
i've been working on this "Number detailer", which is what i call it since i have no other name for it (lol ) and im having a few problems with it, it is ment to be a program that instead of making you enter what you want to do with the two numbers, it does everything ( square the numbers, add them, subtract them multiply them, divide them, all at the same time and then gives you the results of all of these things, anyway this is the code:
/* This is a calculator designed, programmed and made by Tr0y, however
this calulator is differnt though, you enter two numbers and then it
give you the sum product subtraction, square root, etc of your two
number, sort of like a number detailer (If they actually even do exist)*/
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello and welcome to the number detailer, designed, programmed and made by Tr0y.\n" "To continue, press Enter to see the menu"<<endl;
cin.get();
loop:
cout<<"Press a number 1 to 3 for one of the options displayed below.\n";
cout<<"1. View information about the author and the program.\n";
cout<<"2. View the programs C++ code.\n";
cout<<"3. To procede to the Number detailer.\n";
cout<<"Please choose an option now: \n";
int choice;
cin>> choice;
if (choice = 1) {
cout<<"This is a calculator designed, programmed and made by Tr0y, however this\n" "calulator is different though, you enter two numbers and then it give you the \n" "sum,product, subtraction, square root, etc of your two number, It basically\n" "gives you all the details of your two numbers, so if you wanted to know what\n" "5 + 5 was AND 5 * 5, then it would give you these results all at the same time, I call it a number detailer. This program was made by me Tr0y, and i personally give anyone permission to reproduce this program, but NOT,i repeat NOT,\n" "distribute it as your own program, especially if you just copy my code and\n" "change my name to yours, please DON'T do this, Thank you.\n";
cout<<"Press return to go back to the menu\n";
cin.get();
goto loop;
}
else if (choice = 2) {
cout<<"\n";
cout<<"Press return to go back to the menu\n";
cin.get();
goto loop;
}
else if (choice = 3) {
system("cls" ;
cin.get();
}
}
So BASICALLY (TO SUMERISE) when you get to the menu, it give you three choices and i have put differnt things for these choices, so if the person chooses 1 the get the message for number 1, they enter 2 then they get the message for number 2, and finally when they enter three they get the message for choice three.....However the problem is that no matter what number you put (1-3) it gives you the message for choice number one, im not sure where im going wrong to be honest, it must be a problem with my IF syntaxes or something. Any help would be GREAT! thanks.
|
 |
Author | RE: Need help with my C++ program please |
Futility Member

Posts: 740 Location: USA
Joined: 17.12.07 Rank: God | |
= is the assignment operator.
== is for comparison.
|
 |
Author | RE: Need help with my C++ program please |
TROY Member

Posts: 83 Location: Sheffield, UK
Joined: 17.06.08 Rank: Moderate | |
Futility wrote:
= is the assignment operator.
== is for comparison.
Yep!, works great now, Thanks very very much. 
|
 |
Author | RE: Need help with my C++ program please |
hellboundhackersok Member

Posts: 353 Location:
Joined: 20.09.07 Rank: Wiseman Warn Level: 95
| |
TROY wrote:
cout<<"Hello and welcome to the number detailer, designed, programmed and made by Tr0y.\n" "To continue, press Enter to see the menu"<<endl;
wait.. shouldn't this be:
Code cout << "Hello.. blah blah.. made by Tr0y.\n" << "To continue blahblahblah" << endl;
?? Notice the <<
|
 |
Author | RE: Need help with my C++ program please |
bl4ckc4t Member

Posts: 591 Location: /etc/
Joined: 07.03.06 Rank: Wiseman | |
moshbat wrote:
Seriously, read up on your preferred language.:right:
QFT
|
 |
Author | RE: Need help with my C++ program please |
K3174N 420 Member

Posts: 296 Location: In a grow room, growing cannabis.
Joined: 14.09.08 Rank: Hacker Level 1 Warn Level: 69
| |
moshbat wrote:
bl4ckc4t wrote:
moshbat wrote:
Seriously, read up on your preferred language.:right:
QFT
"Quality fæces Time"?
First thing i thought was 'Quit Fucking Talking', Though i could be completly wong and i'ts 'Quite Fucking True'...
Im pretty sure on the middle word... ^^
Anyway, what a dumb post, the differance between = and == is basic. Fundimental. You do need to reread the basics on your languages...
Thanks Yours31f!

Make poverty history... Cheaper drugs now! - Frank gallagher
[small][center]Einstein climbs to the top of Mt. Sinai to get close enough to talk to God.
Looking up, he asks the Lord...
"God, what does a million years mean to you?"
The Lord replies, "A minute."
"Einstein asks, "And what does a million pounds mean to you?"
The Lord replies, "A penny."
Einste |
 |
Author | RE: Need help with my C++ program please |
bl4ckc4t Member

Posts: 591 Location: /etc/
Joined: 07.03.06 Rank: Wiseman | |
K3174N 420 wrote:
moshbat wrote:
bl4ckc4t wrote:
moshbat wrote:
Seriously, read up on your preferred language.:right:
QFT
"Quality fæces Time"?
First thing i thought was 'Quit Fucking Talking', Though i could be completly wong and i'ts ' Quite Fucking True'...
Im pretty sure on the middle word... ^^
Anyway, what a dumb post, the differance between = and == is basic. Fundimental. You do need to reread the basics on your languages...
|
 |
Author | RE: Need help with my C++ program please |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
I liked quit fucking talking better. |
 |
Author | RE: Need help with my C++ program please |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Also, when posting code it's just kind of etiquette to use the code tags and disable smileys. Finally, when learning the C/++ programming languages, I highly recommend you start with C. There's a lot of OOP stuff that's going to throw you for a loop, and when you decide to go more advanced you're going to be pulling your hair out because you didn't start with C first. here's a good analogy: You can either climb a very tall rock wall or carve a steep but manageable slope. C is very powerful as well.
Edited by on 21-12-08 07:08 |
 |
Author | RE: Need help with my C++ program please |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
I believe I'll take that advice and run with it. I have been having trouble making up my mind, whether to start with C or jump straight into C++, and even though I understand the OOP paradigm very well, I still think it would be a good idea to start with C. Plus, after you get the syntax down, there are plenty of languages based on the C syntax, so it would be a lot easier to learn other languages after you got C down. Thanks for helping me make up my mind, I don't know why, but when you put it that way it just kind of clicked with me. lol. |
 |
Author | RE: Need help with my C++ program please |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
Although, on the same note, I found a pretty good tutorial for C and C++, the main one being on C++, thats what the site really focuses on, and they say that with this tutorial, unless you have a specific reason to only learn C, to go ahead into C++, because they start out with all the basic syntax and functions in C (which are the same in C++), and basically teach you C and then tack the OOP and STL on the end for C++. Maybe that would be too much all at once, I don't know, but its basically C until you get to the end of the tutorial, or e-book I should say. Ahh, I digress. I think I'll start on C, but not stay with it very long and go to C++ after I get the basic syntax/functions down, because I get OOP. Blah. |
 |
Author | RE: Need help with my C++ program please |
spyware Member

Posts: 4192 Location:
Joined: 14.04.07 Rank: God Warn Level: 90
| |
It's not "quite fucking true", QFT stands for "Quoted for truth". Mkay? Mkay.

"The chowner of property." - Zeph [small]�Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.� - Carl Sagan [center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce |
 |
Author | RE: Need help with my C++ program please |
TROY Member

Posts: 83 Location: Sheffield, UK
Joined: 17.06.08 Rank: Moderate | |
spyware wrote:
It's not "quite fucking true", QFT stands for "Quoted for truth". Mkay? Mkay.
lol
|
 |
Author | RE: Need help with my C++ program please |
yours31f Member

Posts: 1678 Location: Dallas Texas
Joined: 27.04.07 Rank: Uber Elite | |
Try googleing switch case.
Debugging is what programmers do to beta software to make it take up more room on your hard drive if it is running too efficiently.
 |
 |
Author | RE: Need help with my C++ program please |
ynori7 Member

Posts: 1486 Location: #valhalla
Joined: 08.10.07 Rank: God | |
I dont see why everyone keeps saying to start with C. C++ is much more user friendly for a beginner. Learn the basics with C++ and then move to C.
|
 |
Author | RE: Need help with my C++ program please |
TROY Member

Posts: 83 Location: Sheffield, UK
Joined: 17.06.08 Rank: Moderate | |
ynori7 wrote:
I dont see why everyone keeps saying to start with C. C++ is much more user friendly for a beginner. Learn the basics with C++ and then move to C.
Yeah im sticking with C++, i like it and btw people cans top posting i completed my program successfully earlier today, my first quite long C++ program lol.
|
 |
Author | RE: Need help with my C++ program please |
bl4ckc4t Member

Posts: 591 Location: /etc/
Joined: 07.03.06 Rank: Wiseman | |
spyware wrote:
It's not "quite fucking true", QFT stands for "Quoted for truth". Mkay? Mkay.
It has a double meaning, 90% of the time it is used in a quote in which the quoted says something that the quotee agreed with. Quoted for Truth can mean the same thing as Quite Fucking True. Mkay? Mkay.
|
 |
Author | RE: Need help with my C++ program please |
spyware Member

Posts: 4192 Location:
Joined: 14.04.07 Rank: God Warn Level: 90
| |
bl4ckc4t wrote:
It has a double meaning, 90% of the time it is used in a quote in which the quoted says something that the quotee agreed with. Quoted for Truth can mean the same thing as Quite Fucking True. Mkay? Mkay.
It doesn't have "more" meanings, (well, it does), but it DOESN'T mean "quite fucking true".
The meaning is "quoted for truth". That, and nothing else. Other meanings are assigned when people forget the real/true meaning of the abbreviation. Of course, in this case "quite fucking true" has the same meaning as "quoted for truth", that doesn't make it the valid meaning though.

"The chowner of property." - Zeph [small]�Widespread intellectual and moral docility may be convenient for leaders in the short term,
but it is suicidal for nations in the long term.� - Carl Sagan [center]�Since the grid is inescapable, what were the earlier lasers about? Does the corridor have a sense of humor?� - Ebert[/ce |
 |
Author | RE: Need help with my C++ program please |
bl4ckc4t Member

Posts: 591 Location: /etc/
Joined: 07.03.06 Rank: Wiseman | |
Upon further review, The ruling on the play is overturned. Spyware's ball.
|
 |
Author | RE: Need help with my C++ program please |
Member

Posts: Location:
Joined: 01.01.70 Rank: Guest | |
TROY wrote:
ynori7 wrote:
I dont see why everyone keeps saying to start with C. C++ is much more user friendly for a beginner. Learn the basics with C++ and then move to C.
Yeah im sticking with C++, i like it and btw people cans top posting i completed my program successfully earlier today, my first quite long C++ program  lol.
Anything under 500 lines = short
|
 |