Dyskusje Q&A
class and object
1 Głos
1 OdpowiedźWhy is not working
0 głosów
3 odpowiedziWhye error???
0 głosów
1 Odpowiedźcan someone please explain why this code keeps telling me complication error instead of outputting the value of speed.
#include <iostream>
using namespace std;
class myClass {
public:
void setcarspeed (int a){
speed=a;
}
int getcarspeed(){
return speed;
}
private:
int speed;
};
int main() {
myClass obj;
obj.setcarspeed (40);
cout<<obj.getcarspeed ;
return 0;
}
2 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 odpowiedziI am confused on this
0 głosów
1 Odpowiedźjava learning
0 głosów
1 OdpowiedźWhy not working
-4 głosów
4 odpowiedziPopularne dzisiaj
New code
1 Votes
Clean Code
3 Votes
How would you solve the part of the C# Intermediate code project that requires operator overloading?
0 Votes
Hello Everyone
0 Votes