Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string input;
- while(input != "DONE"){
- if(input == "DONE"){
- break;
- }
- cout<<"Enter the opcode/operand to enter an instruction or 'DONE' to exit: ";
- cin>>input;
- // Seperate input
- bool opcode_bool = true;
- string opcode;
- string operand;
- for(int i = 0; i < input.length(); i++){
- if(input[i] == ' '){
- opcode_bool = false;
- continue;
- }
- if(opcode_bool == true){
- opcode = opcode + input[i];
- }else{
- operand = operand + input[i];
- }
- }
- cout<<opcode<<endl<<operand<<endl;
- cout<<"END OF ITERATION"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement