Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- using namespace std;
- class Esercizio{
- string app1,app2;
- public:
- Esercizio (){}
- void soluzione();
- };
- void Esercizio::soluzione(){
- ifstream probl("Problema.txt");
- ifstream sol("Soluzione.txt");
- ofstream es("Esito.txt");
- while(!sol.eof())
- {
- getline(probl, app1);
- getline(sol, app2);
- int j=1,verifica=1;
- for(int i=0; i< app1.size(); i++)
- {
- if(app1.at(i)==app2.at(j))
- {
- if(app1.at(i)=='>')
- {
- if(app2.at(j-1)<app2.at(j+1))
- {
- i=70;
- verifica=0;
- }
- }
- else
- {
- if(app2.at(j-1)>app2.at(j+1))
- {
- i=70;
- verifica=0;
- }
- }
- }
- else
- {
- i=70;verifica=0;
- }
- j+=2;
- }
- if(verifica==0)
- {
- es<<"Sbagliato!"<<endl;
- }
- else
- {
- es<<"Esatto!"<<endl;
- }
- }
- }
- int main()
- {
- Esercizio q;
- q.soluzione();
- return 0;
- }
Add Comment
Please, Sign In to add comment