Обсуждения
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 ответовGuys please help me with these (assignment) :
-create a function "manipulate_data" that does the following;
1.accepts as the first parameter astring specifying the data structure to be used e. g a list.
2.accepts as the second parameter the data to be manipulated based on the data structure specified e.g [1,4,9,16,25] for alist data structure.
0 голосов
7 ответовi need c++ program does EXAMPLE: If the user entered the #’s: 999, 90,78,82,and 999
the output would be
AVERAGE = 250/3 = 83.3 AVERAGE WITH LOWEST DROPPED = 172/2 = 86.0
AVERAGE WHERE HIGHEST COUNTS TWICE =340/4 = 85.0
NOTE: Validate the input as being a plausible test score and require the user to reenter when not plausible.
1 голос
7 ответовwhy does the 'else' statement on this code only work on the 'if' statement before it. I want it to work for all the 'if' statements in the code (that is, if none of the 'if' statements is true, then the else statement should execute). If that is not possible, then how it can be done?
2 голосов
6 ответовАктуальное сегодня
Help please?
4 Votes
Ejercicio Pytho
0 Votes
What is that z for
0 Votes
Suggestions needed
4 Votes
Game development
0 Votes
Ruby programming?
3 Votes