MahmudulMaruf

Code · Faith · Curiosity

Blog Post

Beecrwod: 1131 - Grenais

cpp �� 2023-08-16 12:36:19

cpp

Problem: 1131 - Grenais

Solution: 

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, t=1, inter=0, grenais=0, draw=0;
    while(1)
    {
        int m=0;
        loop:
        cin>>a>>b;
        if(a>b)
            inter++;
        else if(a==b)
            draw++;
        else
            grenais++;
        cout<<"Novo grenal (1-sim 2-nao)"<<endl;
        cin>>m;
        if(m==1)
        {
            t++;
            goto loop;
        }
        else if(m==2)
            break;

    }
    cout<<t<<" grenais"<<endl;
    cout<<"Inter:"<<inter<<endl;
    cout<<"Gremio:"<<grenais<<endl;
    cout<<"Empates:"<<draw<<endl;
    if(inter>grenais)
        cout<<"Inter venceu mais"<<endl;
    else if(inter==grenais)
        cout<<"Gremio venceu mais"<<endl;
    else
        cout<<"Não houve vencedor"<<endl;
    return 0;
}

Post Visited: 458 times

Categories: cpp

0 Comments

    No comments yet. Be the first to comment!

Leave a comment

Captcha