Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <sstream>
- using namespace std;
- main (){
- string xTemp;
- float x, y;
- y = 0;
- cout << "Insira 10 numeros para ser informado sobre qual deles é o maior. Pressione enter apos cada numero" << endl;
- for (int a = 0; a < 10; a++ ){
- cin >> xTemp;
- stringstream ssX(xTemp);
- ssX >> x;
- if (ssX.fail()){
- cout << "Numero invalido" << endl;
- }
- if (x > y){
- y = x;
- }
- }
- cout << "O maior desses numeros eh " << y << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement