| View previous topic :: View next topic |
| Author |
Message |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 1:13 pm Post subject: How would I make this program restart? |
|
|
| Code: | // Calculator+, by James Fisher
// Include the iostream library
#include <iostream>
//Use the standard namespace
using namespace std;
void main ( )
{
// Declare the variables
float Number_1;
float Number_2;
float Result;
int Which_Calculation;
int Restart;
// Give instructions
cout << "Choose a task. Press 1 to add, 2 to subtract, 3 to multiply, and 4 to divide." << endl;
cin >> Which_Calculation;
// Get numbers
cout << "Please enter the first number." << endl;
cin >> Number_1;
cout << "Please enter the second number." << endl;
cin >> Number_2;
if (Which_Calculation == 1)
{
// Calculate the result
Result = Number_1 + Number_2;
}
if (Which_Calculation == 2)
{
// Calculate the result
Result = Number_1 - Number_2;
}
if (Which_Calculation == 3)
{
// Calculate the result
Result = Number_1 * Number_2;
}
if (Which_Calculation == 4)
{
// Calculate the result
Result = Number_1 / Number_2;
}
// Print the answer is...
cout << "The answer is..." << endl;
// Print the result
cout << Result << endl;
// Ask the user if they would like to do another problem.
cout << "Hit 1 to do another problem, 2 to exit." << endl;
// Restart the application
if (Restart == 1)
{
// Restart the program
HERE!!!
}
if (Restart == 2)
{
// End the program
system ("PAUSE");
cin << "Press any key to end the program." << endl;
}
} |
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
sachamr How do I cheat?
Reputation: 0
Joined: 26 Feb 2011 Posts: 2
|
Posted: Mon Feb 28, 2011 1:16 pm Post subject: |
|
|
| im not really good in programing, but i think you should simply destroy the end so its will create a loop
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Mon Feb 28, 2011 1:30 pm Post subject: |
|
|
| Find some new books
|
|
| Back to top |
|
 |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 1:30 pm Post subject: |
|
|
| Noz3001 wrote: | | Find some new books |
wut?
I don't have a book.
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Mon Feb 28, 2011 1:35 pm Post subject: |
|
|
| The Fish wrote: | | Noz3001 wrote: | | Find some new books |
wut?
I don't have a book. |
This explains it all
|
|
| Back to top |
|
 |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 1:35 pm Post subject: |
|
|
| Noz3001 wrote: | | The Fish wrote: | | Noz3001 wrote: | | Find some new books |
wut?
I don't have a book. |
This explains it all |
It does.
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Mon Feb 28, 2011 1:38 pm Post subject: |
|
|
| Put it all in a while loop or be lazy and use a goto
|
|
| Back to top |
|
 |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 1:44 pm Post subject: |
|
|
| Noz3001 wrote: | | Put it all in a while loop or be lazy and use a goto |
How would I use the loop?
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Mon Feb 28, 2011 1:46 pm Post subject: |
|
|
| The Fish wrote: | | Noz3001 wrote: | | Put it all in a while loop or be lazy and use a goto |
How would I use the loop? |
GET YOUR DICK OUT OF YOUR ASS AND USE GOOGLE
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 1:50 pm Post subject: |
|
|
| Haxory' wrote: | | The Fish wrote: | | Noz3001 wrote: | | Put it all in a while loop or be lazy and use a goto |
How would I use the loop? |
GET YOUR DICK OUT OF YOUR ASS AND USE GOOGLE |
google aint giving me an answer.
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Feb 28, 2011 1:52 pm Post subject: |
|
|
| Haxory' wrote: | | The Fish wrote: | | Noz3001 wrote: | | Put it all in a while loop or be lazy and use a goto |
How would I use the loop? |
GET YOUR DICK OUT OF YOUR ASS AND USE GOOGLE |
FUCKING LOL.
|
|
| Back to top |
|
 |
Haxory' Grandmaster Cheater Supreme
Reputation: 92
Joined: 30 Jul 2007 Posts: 1900
|
Posted: Mon Feb 28, 2011 1:55 pm Post subject: |
|
|
http://www.bluesfear.com/tutorials/C%2B%2Bwhileloop.php
if you cant handle that you should really reconsider your school project or w/e
_________________
you and me baby ain't nothing but mammals so lets do it like they do on the discovery channel |
|
| Back to top |
|
 |
potaters Grandmaster Cheater
Reputation: 72
Joined: 13 Apr 2009 Posts: 969
|
Posted: Mon Feb 28, 2011 1:57 pm Post subject: |
|
|
Fish, may I suggest you ask in teh coding section of this forum?
Or goto a C++ coding forum. Instead of asking the 3~5 skilled C++ coders here.
|
|
| Back to top |
|
 |
The Fish Expert Cheater
Reputation: 3
Joined: 11 Aug 2008 Posts: 114 Location: Ohio bitch
|
Posted: Mon Feb 28, 2011 2:02 pm Post subject: |
|
|
| xen0r wrote: | Fish, may I suggest you ask in teh coding section of this forum?
Or goto a C++ coding forum. Instead of asking the 3~5 skilled C++ coders here. |
The coding section is pretty dead.
I'll get a faster answer here.
_________________
It was nice while it lasted. |
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Feb 28, 2011 2:06 pm Post subject: |
|
|
This is why i hate console projects
|
|
| Back to top |
|
 |
|