콘솔창은 뜨는데 도중에 진행이 안되네요

조회수 32회

include

include

include

include

using namespace std;

//클래스

class vehicle {

private:

int speed;

public:

void SetSpeed(int _s)
{
    speed=_s;
}
int GetSpeed()
{
    return rand()%(speed+1);
}

};

class car : public vehicle { };

class truck : public vehicle

{

public:

int truckspeed;

truck()
    {
        SetSpeed(100);
    }
int t()
    {
        truckspeed=GetSpeed();
        return truckspeed;
    }

};

class bus : public vehicle {

public:

int busspeed;
bus()
    {
        SetSpeed(150);
    }
int b()
    {
        busspeed=GetSpeed();
        return busspeed;
    }

};

class sportscar: public car

{

public:

int sportsspeed;
sportscar()
{
    SetSpeed(100);
}
int s()
{
    sportsspeed=GetSpeed();
    return sportsspeed;
}

};

int main() {

sportscar s1;
sportscar s2;
bus b1;
bus b2;
truck t1;
truck t2;
int input1,input2,input3,input4;
int i,j;
int a=0,b=0;
int awin=0,bwin=0;
int at=0,bt=0;

//input part

cout<<"sportcar=1 bus=2 truck=3"<<endl;
cout<<"car 1="<<endl;
cin>>input1;
cout<<endl;
cout<<"car 2="<<endl;
cin>>input2;
cout<<endl;
cout<<"test time="<<endl;
cin>>input3;
cout<<endl;
cout<<"test dose="<<endl;
cin>>input4;
cout<<endl;

//test part

for(j=0;j=input4;j++)
{
        for(i=0;i=input3;i++)
    {
        switch(input1)
        {
        case 1:{s1.SetSpeed(200);s1.s();a+=s1.sportsspeed;}
        case 2:{b1.SetSpeed(150);b1.b();a+=b1.busspeed; }
        case 3:{t1.SetSpeed(100);t1.t();a+=t1.truckspeed;}
        }

        switch(input2)
        {
        case 1:{s2.SetSpeed(200);s2.s();b+=s2.sportsspeed;}
        case 2:{b2.SetSpeed(150);b2.b();b+=b2.busspeed;}
        case 3:{t2.SetSpeed(100);t2.t();b+=t2.truckspeed;}
        }
    }





    //test result
    //total d
    at+=a;
    bt+=b;

    //winner point
    if(a>b)
    {
        awin+=1;//awin
    }
    else if(a<b)
    {
        bwin+=1;//bwin
    }
    else 
    {
        //draw
    }
    //for retest
    a=0;
    b=0;
}



//total result




    switch(input1)
    {
        case 1:cout<<"car1=sportscar average distant="<<at/input4<<"win%="<<awin/input4<<"%"<<endl;break;
        case 2:cout<<"car1=bus average distant="<<at/input4<<"win%="<<awin/input4<<"%"<<endl;break;
        case 3:cout<<"car1=truck average distant="<<at/input4<<"win%="<<awin/input4<<"%"<<endl;break;
    }

    switch(input2)
    {
        case 1:cout<<"car2=sportscar average distant="<<bt/input4<<"win%="<<bwin/input4<<"%"<<endl;break;
        case 2:cout<<"car2=bus average distant="<<bt/input4<<"win%="<<bwin/input4<<"%"<<endl;break;
        case 3:cout<<"car2=truck average distant="<<bt/input4<<"win%="<<bwin/input4<<"%"<<endl;break;
    }

}

for문 전까지 입력은 받는데 나머지가 안되요 ㅠㅠ

1 답변

답변을 하려면 로그인이 필요합니다.

Hashcode는 개발자들을 위한 무료 QnA 사이트입니다. 계정을 생성하셔야만 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 계정을 생성하셔야만 글을 작성하실 수 있습니다.