Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main(){
- string nombres[3];
- int edades[3];
- for(int i=0; i<3; i++){
- cout << "ingrese nombre: ";
- cin>>nombres[i];
- cout << "ingrese edad: ";
- cin>>edades[i];
- }
- int mayor = edades[0];
- int posicion = 0;
- for(int i =0; i<3; i++){
- if(edades[i] > mayor){
- mayor = edades[i];
- posicion = i;
- }
- }
- cout << "La edad mas mayor es " <<mayor << " y se llama " << nombres[posicion] << endl;
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement