Обсуждения
I recently created and saved a small program privately and now I cannot figure out how to open it to edit and run it. I am new to using this app to create and run Java programs and would like to know how to do this in order to edit and reuse my programs. How do I open a program I have privately saved?
1 голос
2 ответовI wrote a simple basic c++ code in my PC notepad and I saved it with .cpp extension also. But when I run this program in any browser it shows the code as it is... Do c++ code can be written in notepad and can be run? Please answer.
#include <iostream>
using namespace std;
int main()
❴
cout << "hello";
return0;
❵
2 голосов
10 ответовwhy does this code output that there is an error because the else statement doesn't have a corresponding if statement?. How do i correct this?
#include <iostream>
using namespace std;
int main() {
int a;
for (int x =0; x<5;x++){
cin>>a;
if (a<1){
cout<<"a cannot be less than 1\n";
}
else if (a>10){
cout <<"a cannot be greater than 10\n";
}
}
else{
cout<<"code can run now"<<endl;
}
return 0;
}
3 голосов
8 ответов