![]() |
|
|
#26 | |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Quote:
Well, I did it made a simple calculator, and then amazingly deleted it (perminatly) ![]() ALTHOUGH! Im going to redo it anyways just to give me more practice, and then ill post the code up.
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
|
#27 |
![]() Join Date: Sep 2008
Location: Austin Texas
Posts: 618 (1.43/day)
Thanks: 148
Thanked 37 Times in 33 Posts
|
Reading all this just makes me feel stupid!
![]() ![]() ![]() |
|
|
|
|
|
#28 |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Okay so I just did a simple code. It wasnt compiled or debuged. Im copy and paste straight from my script.
Code:
#include <iostream>
#include <cstdlib>
using namespace STD;
int main()
{
double num;
double num2;
char input;
For (;;)
{
Do
{
COUT << "Welcome to Th3 C41c";
COUT << "To begin Choose what function you would like to preform from the list provided for you";
COUT << "1 - Addition";
COUT << "2 - Subtraction";
Cout << "3 - Multiplication";
Cout << "4 - Divide";
Cin >> input
}
while ( input > 1 || input < 4 );
{ Case '1';
Cout << "Please enter your first number";
Cin >> num;
Cout << "Please enter your second number";
cin >> num2;
Cout << num + num2;
Case '2';
Cout << "Please enter your first number";
Cin >> num;
Cout << "Please enter your second number";
Cin >> num2;
Cout << num - num2;
Case '3';
Cout << "Please enter your fist number";
Cin >> num;
Cout << "please enter your second number";
cin >> num2;
Cout << num * num2;
Case '4';
Cout << "Please enter your first number";
Cin >> num;
Cout << "Please enter your second number";
Cin >> num2;
Cout << num / num2;
}
Return 0;
}
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
#29 |
|
TPU Hit Squad Member
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 3,240 (3.18/day)
Thanks: 92
Thanked 766 Times in 581 Posts
|
You have a couple of problems.
First, you while statment is only looping on 2 and 3. You want to fo something like (input >= 1 && input <= 4) so you include 1 and 4 You will also need a switch statement in order to use the case statements Code:
switch (input)
{
Case '1':
.....
}
__________________
53452340602F55453253602E35572D$20
|
|
|
|
| The Following User Says Thank You to Kreij For This Useful Post: |
|
|
#30 | |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Quote:
Oh okay.Well there wasn't as many mistakes as I thought there was going to be. haha. I fully understand everything but the For loop portion of my mistake. Im going to fix that and try to figure that out. For my first real code, it wasnt that bad.
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
|
#31 |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Sorry for the double post, but this is irrealivant to what the previous post said and if i were to edit, no one would see it as they have already looked at it without this.
Can I buy a complier? If so, Where? (p.s. I just made another calculator that does Square Root. When Visual Studio gets done downloading i will test and post if anyone wants to see it.)
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
#32 |
|
TPU Hit Squad Member
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 3,240 (3.18/day)
Thanks: 92
Thanked 766 Times in 581 Posts
|
You can download Microsoft's C++ express for free.
http://www.microsoft.com/Express/VC/
__________________
53452340602F55453253602E35572D$20
|
|
|
|
|
|
#33 | |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Quote:
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
|
#34 |
|
TPU Hit Squad Member
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 3,240 (3.18/day)
Thanks: 92
Thanked 766 Times in 581 Posts
|
In all honesty, Munki, at the level you are programming any version will do fine.
No offense intended, but you have to start somewhere and you are off to a great start !!! I think that you find using the Integrated Development Environment (IDE) that the Visual Studio products integrate will make you life much easier. Don't worry about what compiler/IDE is better, work on learning using the language you are working with, and in particular, learn the basics very well. Keep the questions coming.
__________________
53452340602F55453253602E35572D$20
|
|
|
|
|
|
#35 | |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Quote:
No offense taken (I know its true )I built another script that does, Addition, Subtraction, Multiplication, Division and square root. I'm getting errors that i cant find the error. I ran debugger but I do not understand why its like that, I go back to the line(s) and it appears right to me. Ill access my external and post up the code in case you have time time to check it out. Code:
#include <iostream>
#include <math>
#include <cstdlib>
using namespace STD;
int main ()
{
Double num;
Double num2;
Char input;
For (;;)
{
Cout << " Please select your function. ";
COut << " 1 - Addition ";
Cout << " 2 - Subtraction";
Cout << " 3 - Multiplication ";
Cout << " 4 - Division ";
Cout << " 5 - Square Root:;
}
While ( input <= '1' && input >= '5' )
Switch (input)
{
Case '1':
Cout << " Please input your first number ";
Cin >> num;
Cout << " Please input your second number ";
Cin >> num2;
Cout << num + num2;
Case '2':
Cout << " Please input your first number ";
Cin >> num;
Cout << " Please input your second number ";
Cin >> " num2;
Cout << num - num2;
Case '3':
Cout << "Please input your first number ";
Cin >> num;
Cout << "Please input your second number ";
cin >> num2;
Cout num * num2;
Case '4':
Cout << " Please input your first number ";
Cin >> num;
Cout << " Please input your second number ";
Cin >> num2;
Cout << num / num2;
Case '5':
Cout << " Please input the number you want to find the square root of. ";
Cin >> num;
if ( num < 0 )
{
Cout << "Number is negative. ";
}
Else
{
num2 = sqrt(num);
Cout << num2;
}
Return 0;
}
I'm going to continue to try to locate this error.
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
|
#36 |
|
TPU Hit Squad Member
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 3,240 (3.18/day)
Thanks: 92
Thanked 766 Times in 581 Posts
|
Code:
While ( input <= '1' && input >= '5' ) Also in case '3' The output should be cout << num * num2; (You are missing the '<<') What error are you getting ?
__________________
53452340602F55453253602E35572D$20
Last edited by Kreij; 11-10-2009 at 04:25 PM. |
|
|
|
|
|
#37 |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Well for the most part it was claiming that COUT, and CIN were not called (initiated)
My compiler is installing on this computer. I wish I could install it on a jump drive so I didn't have to install it on 7 computers. Im going to add some 'breaks' throughout the code to keep it from leaking through. I fixed my less than and greater than error. As well as my COUT error. Im going to end the forever loop, seeing as to how I blankly failed to do so. And finally added my Switch statement within the brackets.
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay Last edited by Munki; 11-10-2009 at 07:04 PM. |
|
|
|
|
|
#38 |
![]() Join Date: Sep 2008
Location: Georgia
Posts: 299 (0.69/day)
Thanks: 21
Thanked 23 Times in 20 Posts
|
Isnt
#include <iostream> suppose to declare COUT and CIN?
__________________
![]() Referances: Heatware: ipphreak ebay: mollymay506 amazon: insane_monkay |
|
|
|
|
|
#39 |
|
TPU Hit Squad Member
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 3,240 (3.18/day)
Thanks: 92
Thanked 766 Times in 581 Posts
|
If you are using Visual C++ add #include "stdafx.h" above the iostream include.
Don't capitalize cout.
__________________
53452340602F55453253602E35572D$20
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Which audio to use | theonetruewill | General Hardware | 6 | 07-10-2007 11:54 PM |
| Which program to use | trt740 | Overclocking & Cooling | 4 | 05-29-2007 08:56 PM |
| Which to use | gerrynicol | Graphics Cards | 20 | 08-29-2006 08:32 PM |
| Which should i use? | BigD6997 | Graphics Cards | 5 | 07-06-2006 12:48 AM |