Advertisement
Guest User

maiordos10

a guest
Jul 5th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7.  
  8. main (){
  9.     string xTemp;
  10.     float x, y;
  11.     y = 0;
  12.     cout << "Insira 10 numeros para ser informado sobre qual deles é o maior. Pressione enter apos cada numero" << endl;
  13.     for (int a = 0; a < 10; a++ ){
  14.         cin >> xTemp;
  15.         stringstream ssX(xTemp);
  16.         ssX >> x;
  17.         if (ssX.fail()){
  18.             cout << "Numero invalido" << endl;
  19.         }      
  20.         if (x > y){
  21.             y = x;
  22.         }
  23.     }
  24.     cout << "O maior desses numeros eh " << y << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement