Task: | Ohjelma |
Sender: | gokuha |
Submission time: | 2017-01-19 17:13:20 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:8:5: error: 'i' was not declared in this scope if (i%3==0){ ^ input/code.cpp:11:7: warning: statement has no effect [-Wunused-value] for( n!=1; i++){ ^ input/code.cpp:11:15: error: expected ';' before ')' token for( 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 (i%3==0){ cout<<0;} int i=0; for( 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"}