Răspuns :
Răspuns:
#include <iostream>
#include <string.h>
using namespace std;
char s[ 101 ];
bool eVocala( char c )
{
if( c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U' )
return true;
else
return false;
}
int main()
{
int maxim = -1, suma = 0;
char v1 = 0, v2 = 0, v3 = 0;
cin.getline( s, 100 );
for( int i = 0; i < strlen( s ); ++i )
{
if( s[ i ] >= '0' && s[ i ] <= '9' )
{
int j = i + 1, numarCurent = s[ i ] - '0';
while( s[ j ] >= '0' && s[ j ] <= '9' )
{
numarCurent *= 10;
numarCurent += s[ j ] - '0';
++j;
}
suma += numarCurent;
if( numarCurent > maxim )
{
maxim = numarCurent;
}
}
else if( eVocala( s[ i ] ) )
{
if( v1 == 0 )
{
v1 = s[ i ];
}
else if( v2 == 0 )
{
v2 = s[ i ];
}
else if( v3 == 0 )
{
v3 = s[ i ];
}
}
}
cout << maxim;
cout << endl;
if( maxim % 2 == 0 )
cout << suma;
else
cout << v1 << " " << v2 << " " << v3;
return 0;
}
Explicație:
Vă mulțumim pentru vizita pe site-ul nostru dedicat Informatică. Sperăm că informațiile prezentate v-au fost utile. Dacă aveți întrebări sau aveți nevoie de suport suplimentar, nu ezitați să ne contactați. Ne bucurăm să vă revedem și vă invităm să ne adăugați în lista de favorite!