Q&A Discussões
#include <iostream>
using namespace std;
class employee
int main()
{
private:
double salary;
public:
void getsalary(double sal)
{
salary=sal;
}
void display()
{
cout<<"the salary:"<<salary;
}
};
void main ()
{
employee programmer;
employee manager;
manager.getsalary (60000.0);
programmer.getsalary(40000.0);
manager.display();
programmer.display();
return 0;
}
1 Voto
5 RespostasI wrote a simple basic c++ code in my PC notepad and I saved it with .cpp extension also. But when I run this program in any browser it shows the code as it is... Do c++ code can be written in notepad and can be run? Please answer.
#include <iostream>
using namespace std;
int main()
❴
cout << "hello";
return0;
❵
2 Votos
10 Respostaspublic class Vehicle {
int maxSpeed;
int wheels;
String color;
double fuelCapacity;
void horn() {
System.out.println("Beep!");
}
}
class MyClass {
public static void main(String[ ] args) {
Vehicle v1 = new Vehicle();
Vehicle v2 = new Vehicle();
v1.color = "red";
v2.horn();
System.out.println(v1);
}
}
Explain its outcome. I am unable to get the last line of outcome.
-1 Voto
2 RespostasBeginer Help
2 Votos
3 RespostasPlease Helpp
1 Voto
1 RespostaJava
2 Votos
3 RespostasOutput of C++ code
0 Voto
2 RespostasQuente hoje
Pig Latin
0 Votes
Please rate my code from 1 to 10
2 Votes
Square Roots
0 Votes
What's wrong with this?
2 Votes
Uuu
2 Votes
I’m new someone can help me
0 Votes
Recursion doubt
2 Votes