Created
December 16, 2014 10:48
-
-
Save BraynStorm/5afff8692901d2d413e2 to your computer and use it in GitHub Desktop.
Zadacha1_Razdel2Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
class LinearEquasion{ | |
private: | |
double a,b; | |
public: | |
LinearEquasion(){ | |
cout << "Vuvedi a,b: "; | |
cin >> a >> b; | |
} | |
bool isDataValid(){ | |
return a != 0 || (a == 0 && b == 0); | |
} | |
void printSolution(){ | |
if(isDataValid()){ | |
if(a==0){ | |
cout << "Vsqko X e reshenie." << endl; | |
return; | |
} | |
cout << "Reshenieto e: " << b/a << endl; | |
return; | |
} | |
cout << "Nqma reshenie." << endl; | |
} | |
~LinearEquasion(){ | |
cout << "Destoying object..." << endl; | |
} | |
}; | |
int main(){ | |
LinearEquasion *a = new LinearEquasion(); | |
if(a->isDataValid()){ | |
cout << "Informaciqta e validna" << endl; | |
a->printSolution(); | |
}else{ | |
cout << "Informaciqta e nevalidna" << endl; | |
} | |
delete (a); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment