Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <conio.h>
- using namespace std;
- string toUpperCase(string);
- int main()
- {
- char chuleta [][20] =
- {
- {'B','A','A','C', 'C','C','C','B', 'D','A','D','A', 'D','D','B','B', 'B','C','B','C'},
- {'A','B','B','C', 'A','A','B','B', 'C','B','C','B', 'B','D','A','A', 'C','C','D','D'}
- };
- string auxR;
- enum examen {A, B, ERROR};
- int aux;
- cout << "Cual es tu examen?" << endl << "A -> 0" << endl << "B -> 1" << endl;
- cin >> aux;
- cout << endl << "Introduce tu respuesta, si no has contestado alguna pon una \'x\'" << endl << "Ejemplo: \"abxac\"" << endl;
- cin >> auxR;
- auxR = toUpperCase(auxR);
- double be=0.0,mal=0.0;
- for(int a=0;a<20;a++){
- if(auxR[a]==chuleta[aux][a]) be++;
- else if (auxR[a]!='X') mal++;
- }
- double aux2=0, nota=0.0;
- if (mal==0) aux2++; else aux2= mal/3;
- nota = be - aux2;
- nota = nota / 2.0;
- cout << endl << "Tu puntuacion es de " << nota << endl;
- getch();
- }
- string toUpperCase(string s){
- for (unsigned int a=0;a<s.length();a++)
- {
- if(s[a]>=((int)'a') && s[a]<=((int)'z'))
- {
- s[a]= (char)(((int)s[a])-32);
- }
- }
- return s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement