Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- void Unesibroj()
- {
- double broj;
- for(;;)
- {
- std:: cin>> broj;
- if(std:: cin) break;
- std:: cout << "Neispravan unos. Molimo, pokusajte ponovo."<< std:: endl;
- std:: cin.clear();
- std:: cin.ignore(1000, '\n');
- }
- }
- int main()
- {
- double a, b, c;
- std:: cout << "Unesite koeficijent a: ";
- Unesibroj();
- std:: cout << "Unesite koeficijent b: ";
- Unesibroj();
- std:: cout << "Unesite koeficijent c: ";
- Unesibroj();
- if(a==0)
- std:: cout<< "Nema rješenja!";
- else
- std:: cout<< "Rjesenje je: "<< (c-b)/a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement