Q&A Discussions
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 Votes
8 AnswersOutput who can explain?
1 Vote
1 AnswerExplain please
0 Votes
2 AnswersAnyone help me with this?
0 Votes
2 Answerswhat is tjis code problem!
#include <iostream>
using namespace std;
int main()
{
int b = 5;
int arr[b] = {11, 35, 62, 555, 989};
int sum = 0;
for (int x = 0; x < 5; x++) {
sum += arr[x];
}
cout << sum << endl;
return 0;
}
I cannot make an array using int variable in order to define array's element number!?
1 Vote
7 AnswersHow can I write cool?
2 Votes
4 AnswersCode:Blocks New project how
0 Votes
0 AnswersHow to output Cyrillic?
2 Votes
1 AnswerWhy Doing so much stuff?
0 Votes
2 AnswersHey There ! help me in C++
0 Votes
1 AnswerWher is mistake?
0 Votes
5 AnswersHeader file of C++
0 Votes
1 AnswerHot today
Ejercicio Pytho
0 Votes
Pig Latin
0 Votes
Please rate my code from 1 to 10
2 Votes
Square Roots
0 Votes
Uuu
1 Votes
How to start
0 Votes