Task: | Ohjelma |
Sender: | gokuha |
Submission time: | 2017-01-19 17:14:46 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:11:9: warning: unused variable 'o' [-Wunused-variable] for(int o=0; n!=1; i++){ ^ input/code.cpp:20:12: error: expected ';' before '}' token cout<<"END"} ^
Code
#include<iostream>#include<vector>using namespace std;int main(){int n;cin>>n;vector<string> p;if (n%3==0){cout<<0;}int i=0;for(int o=0; n!=1; i++){if (n%3==1){n-=3;p[i]="ADD";}else{if (n%2==0){n/=2;p[i]="MUL"; }}}for (int j=p.size()-1; j>=0; j--){cout<<p[j];}cout<<"END"}