All pastes #263779 Raw Edit

Untitled

public cpp v1 · immutable
·published 2006-12-01 20:10 UTC
rendered paste body
#include <iostream>#include <sstream>#include <string>using namespace std;int main()	{	char vars[4]={ "a", "b", "c", "d"};	long g, h;	char Restart;	const char * roman[4][3]={"I","II","III", "IV"};	bool nFound = false;	string str; 		cout<<"Hello, welcome to Shayne's Equality Calculator!\n";	cout<<"Imagine the equality layed out as an X Y graph,\n";	cout<<"with each quadrant numbered 1 - 4. Please input\n";	cout<<"the data accordingly, using x as the variable.\n\n\n";		for(int x = 0; x < 4; x++) 		{            cout<<"Quadrant " << roman[x] <<endl;            cin >>str;			if(str == "x") {				if(nFound = false)				{					nFound = true;					str >> vars[x];				}				else				{					std::cout<<"Error\n";					return 1;				}				}				else			{				std::istringstream istr(str);				istr >> vars[x];			}		}    	if(nFound == true)		{		cout<<"\n\nError - Please make sure you are using x as your\n";		cout<<"variable at least one time, but only one time.\n";		goto stop;		}	else if (a == "x")			{		g=b*d;		h=g/c;				cout << "x = " << h << endl;		goto stop;		}	else if (b == "x")			{		g=c*a;		h=g/d;						cout << "x = " << h << endl;		goto stop;		}	else if (c == "x")			{		g=d*b;		h=g/a;				cout << "x = " << h << endl;		goto stop;		}	else if (d = "x")			{		g=a*c;		h=g/b;						cout << "x = " << h << endl;		goto stop;		}	stop:	cout << "\n\n(r)estart, (e)xit\n";	cin >> Restart;	switch (Restart)		{		case 'r':		system("CLS");		return main();		break;					case 'e':		return 0;		break;		default:		printf("Invalid key: Use 'e' or 'r'\n");		break;		}		return 0;   	}