본문 바로가기

카테고리 없음

enum

#include "stdafx.h"

#include <iostream>

#include <string>


enum State {

Stop,

Playing,

Paused

};


State CIn(void) {

using namespace std;


string input;


cin >> input;


if (input == "Playing") {

return Playing;

}

else if (input == "Paused") {

return Paused;

}

else {

return Stop;

}


}


int main() {

using namespace std;

State play = Playing;



while (true) {

if (play == Playing)

{

cout << "Playing" << endl;

}

else if (play == Paused)

{

cout << "Paused " << endl;

}

else if (play == Stop) {

cout << "Stop." << endl;


break;

}


play = CIn();

}


return 0;

}