All pastes #809287 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-08 18:55 UTC
rendered paste body
#include <string>
#include <sstream>

using namespace std;
void calc_soc()
{
	std::cout << "Hello world!" << std::endl;

	int normbelopp = 3470;

	string getlineOutput;
	int hyra;
	int el;
	int akassa;
	int behov;

	cout << "Hyra (3798): ";
	getline(cin, getlineOutput);
	stringstream str(getlineOutput); str >> hyra;
	if (getlineOutput == "") {
		hyra = 3798;
	}
	cout << hyra << endl;
	cout << "Elräkning (0): ";
	getline(cin, getlineOutput);
	str << getlineOutput; str >> el;
	if (getlineOutput == "") {
		el = 0;
	}
	cout << el << endl;
	cout << "A-kassa (4000): ";
	getline(cin, getlineOutput);
	str << getlineOutput; str >> akassa;
	if (getlineOutput == "") {
		akassa = 3738;
	}
	cout << akassa << endl;
	
	behov = (normbelopp + hyra + el) - akassa;
	cout << endl << "Behov:    " << behov << endl;

	cout << "Telefon:   -78" << endl;
	cout << "Internet: -295" << endl;
	cout << "Morsan:   -200" << endl;
	cout << "Över:     " << behov-78-295-200 << endl;
}


int main()
{
	string menyval;
	cout << " - Meny - " << endl;
	cout << endl << "1 - Socberäkning" << endl << endl << "Val: ";

	getline(cin, menyval);

	if (menyval == "1")
	{
		calc_soc();
	} else if (menyval == "") {
		calc_soc();
	}	
	return 0;
}