F&A Diskussionen
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 Stimmen
8 AntwortenOutput who can explain?
1 Stimme
1 AntwortExplain please
0 Stimmen
2 AntwortenAnyone help me with this?
0 Stimmen
2 AntwortenHow do you play Code Coach?
1 Stimme
5 AntwortenHow can I write cool?
2 Stimmen
4 Antwortenwhat 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 Stimme
7 AntwortenCode:Blocks New project how
0 Stimmen
1 AntwortHow to output Cyrillic?
2 Stimmen
1 AntwortA very strange and rare issue
2 Stimmen
3 Antwortenhelp
-2 Stimmen
5 AntwortenWhy Doing so much stuff?
0 Stimmen
2 AntwortenWhat is wrong with this c++ code?
0 Stimmen
3 AntwortenWhat does the 'cout' operator do?
2 Stimmen
2 AntwortenDoesn't output a thing (C++)
1 Stimme
2 AntwortenHey There ! help me in C++
0 Stimmen
1 AntwortHow I do that program in python
-1 Stimme
1 AntwortWY I get a rundum number from memory when I run this code
#include <iostream>
using namespace std;
int main ()
{
int array [5];
for (int x = 0; x < 5; x++) {
array [x] = 42;
cout << x << ': ' << array [x] << endl;
}
return 0;
}
if I replace ': ' with ": " every thing works well.
0 Stimmen
2 AntwortenWher is mistake?
0 Stimmen
5 AntwortenHeader file of C++
0 Stimmen
1 AntwortHeute heiß
C pointers
2 Votes
Python
0 Votes
Guys help please
0 Votes
Slicing in python
1 Votes
Python question
1 Votes
Control flow
0 Votes
HTML
0 Votes
Front-end vs Full-stack
1 Votes