Dyskusje Q&A
Output of C++ code
0 głosów
2 odpowiedziCan anyone explain this code.
2 głosów
1 Odpowiedźhelp
-2 głosów
5 odpowiedziIn the code below the output is 2. This code is used in a challenge and I get an error when I select the answer 2. It accepts as correct the answer 1 which I believe is wrong. If you agree please thumbs up.
If you find any other errors please post them here!
#include <iostream>
using namespace std;
int main()
{
for(int i=1; i>=1; i++) {
if(i<1 || i>1){
cout << i;
break;
}
}
return 0;
}
8 głosów
8 odpowiedziWY 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 odpowiedziLoop
1 Głos
5 odpowiedziWhat's Wrong With My Code??
0 głosów
2 odpowiedziما هو الخطأ فى هذا الكود
0 głosów
2 odpowiedziC#
0 głosów
1 OdpowiedźWhy is not working
0 głosów
3 odpowiedziusing System;
namespace GoodProgrammerTest
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter Yes or No");
Console.Write(
"Do you programme every day? : ") ;
int answer = Console.ReadLine();
if (answer =="Yes")
{
Console.WriteLine(
"You will be a good programmer");
}
else
{
Console.WriteLine(
"You will not be a good programmer");
}
}
}
}
2 głosów
3 odpowiedziPopularne dzisiaj
New code
1 Votes
How would you solve the part of the C# Intermediate code project that requires operator overloading?
0 Votes
Hello Everyone
0 Votes