これが私が持っているものです。私がすべてを投稿する必要があるかどうか教えてください。「tccfcc(enter)」と入力すると、cube.rotateTopNeg90()、次にcube.rotateFrontNeg90()が印刷されたキューブで機能するようになります。編集:申し訳ありませんが、それは上記の私の質問です、今のところコマンドは一度に1つしか機能しません(つまり:'tcc'(入力)'fcc'(入力)...)私はそれをこのようなものにしたい('tcc '' fcc'' tcc'' tcc'....(好きなだけ繰り返す)(入力))その後、それぞれが連続して処理されます。だから私はcinだけを使うことはできません。私はここで前にこれを尋ねました、しかし私は本当にそれを正確に行う方法を知りません。
class RubiksCube
{
public:
RubiksCube::RubiksCube() { /*stuff here*/ }
void display() { /*prints the cube unfolded here*/ }
void rotateTopNeg90() { /*moves top of the cube counterclockwise*/ }
void RubiksCube::rotateFrontNeg90() { /*moves front counterclockwise*/ }
}
//main
int main(int argc, char *argv[])
{
RubiksCube cube;
string s;
srand(time(0));
while (1)
{
string rotateTopNeg90 = "tcc";
string rotateFrontNeg90 = "fcc";
cube.display();
cout << "COMMAND:";
getline(cin,s);
istringstream stream(s);
if (s == rotateTopNeg90 )
cube.rotateTopNeg90();
if ( s == rotateFrontNeg90 )
cube.rotateFrontNeg90();
}
return 0;
}