Convertir codigo de C++ a Raptor
Publicado por abigail (1 intervención) el 06/03/2020 16:05:06
alguien que me pueda ayudar a pasar este lenguaje c++ a raptor ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
using namespace std;
struct estudiante{
string matricula;
char voto;
};
bool unico( string m, vector<estudiante> v );
char ganador( int a, int b, int c );
int main()
{
int A, B, C, total;
char opcion;
estudiante e;
vector<estudiante> v;
A = B = C = total = 0;
cout << "\nVotaciones de los estrudiantes:";
do{
do{
cout << "\nMatricula: "; cin >> e.matricula;
} while( unico( e.matricula, v ) == false );
do{
cout << "Voto: "; cin >> e.voto;
e.voto = toupper( e.voto );
} while( e.voto != 'A' && e.voto != 'B' && e.voto != 'C' );
if( e.voto == 'A' )
A++;
else if( e.voto == 'B' )
B++;
else
C++;
total++;
v.push_back( e );
cout << "\nIntroducir otro voto(S/n): "; cin >> opcion;
opcion = toupper( opcion );
}while( opcion == 'S' && total < 101 );
cout << "\nTotal votos de A: " << A
<< "\nTotal votos de B: " << B
<< "\nTotal votos de C: " << C
<< "\nGanador: " << ganador( A, B, C )
<< endl;
return 0;
}
bool unico( string m, vector<estudiante> v )
{
vector<int>::size_type sz = v.size();
for( unsigned i = 0; i < sz; i++ ) {
if( m == v[i].matricula ){
cout << "\nYa existe, introduzca otra\n";
return false;
}
}
return true;
}
char ganador( int a, int b, int c )
{
if( a > b ){
if( a > c )
return 'A';
else return 'C';
} else {
if( b > c )
return 'B';
else
return 'C';
}
}
Valora esta pregunta


0