Dyskusje Q&A
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 głosów
8 odpowiedziExplain please
0 głosów
2 odpowiedziAnyone help me with this?
0 głosów
2 odpowiedziHow can I write cool?
2 głosów
4 odpowiedziwhat 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 Głos
7 odpowiedziCode:Blocks New project how
0 głosów
1 OdpowiedźHow to output Cyrillic?
2 głosów
1 Odpowiedźhelp
-2 głosów
5 odpowiedziWhy Doing so much stuff?
0 głosów
2 odpowiedziHey There ! help me in C++
0 głosów
1 OdpowiedźWY 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 głosów
2 odpowiedziWher is mistake?
0 głosów
5 odpowiedziHeader file of C++
0 głosów
1 OdpowiedźPopularne dzisiaj
How to allow one instance of exe
1 Votes
purchase of a subscription
1 Votes
Theater management help me
2 Votes
What has happened?
1 Votes
What should I add/improve ?
1 Votes
Tools for web design?
1 Votes