All pastes #934997 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-09 07:24 UTC
rendered paste body
#include <iostream>
#include <cstdlib>

using namespace std;

int add(int a, int b) {

int c = 0; 
c = a + b; 
return c;

}

int subtract(int a, int b) {

int c = 0; 
c = a - b; 
return c;

}

int main() {
	
	int a,b,c,decision;
	
	// Step I: Input
	
	cin >> a;
	cout << "\n;"
	cin >> b;
	cout << "\n";
	
	// Step II: What are we going to do with these integers?
	
	cout << "What would you like to do? (1) Add or (2) Subtract" << "\n"; // The "\n" allows us to go to next line 
	cin >> decision; // take in the decision, 1 or 2
	
	// Step III: Do whatever you're going to do with them
	
	if (decision == 1) { c = add(a,b); };
	if (decision == 2) { c = subtract(a,b);};
		
	// Step IV: Return the value
	cout << "End value:" << c; 


    system("PAUSE");
    return EXIT_SUCCESS;

}