All pastes #655561 Raw Edit

Alain de Callafon

public cpp v1 · immutable
#655561 ·published 2007-08-13 13:49 UTC
rendered paste body
//abc-formule( eerste programma)#include <iostream>#include <math.h>using namespace std;int main (){	//declareren van variabelen	float a, a2, b, b2, b3, b4, c, D, sqrD, x, x1;	//invoeren van variabelen	cout << "Voer variabele a in." << endl;	cin >> a;	cout << "Je hebt het getal: " << a << " ingevoerd" << endl;	cout << "Voer variabele b in." << endl;	cin >> b;	cout << "Je hebt het getal: " << b << " ingevoerd" << endl;	cout << "Voer variabele c in." << endl;	cin >> c;	cout << "Je hebt het getal: " << c << " ingevoerd" << endl;		//berekenen van overige variabelen	a2 = 2*a;	b2 = b*b;	b3 = b-b2;	D = b2-4*a*c;	sqrD = sqrt (D);		//berekenen van eindantwoord x	x = (b3-sqrD)/a2;	x1 = (b3+sqrD)/a2;		cout << "D = " << D << endl;				if (D < 0)		cout << "x heeft geen oplossingen." << endl;				else if (D > 0)		cout << "x = " << x << " of x = " << x1 << endl;				else 		cout << "x = " << x << endl;		return 0;}