Dyskusje Q&A
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 odpowiedziWhat ever I learned here most of the things are not working in turbo c++ ? i.e . instead of iostrem I have to write iostream. h . why is this so?? also it is not accepting this- using namespace std;
. and also not accepting return 0; . Please help me iam really confused. Thanks :)
0 głosów
5 odpowiedziin order to find the sum of n numbers given by user,suppose our program is to find the sum of any 4 numbers given by user (using while loop such that (while(i<=4))and incrementing each value of i by 1),if the user give any 2 inputs instead of four then the total sum should be the summation of that two inputs..but the program shows the sum something else,why it is so??
2 głosów
3 odpowiedziRetrieve lost work and XP
0 głosów
1 OdpowiedźPopularne dzisiaj
is python better than JS
0 Votes
Most asked 3.0
1 Votes
Print("hello ,world!"[7:13][2])
0 Votes
How can i improve my code
1 Votes
time complexity
1 Votes
Python
0 Votes
How to Start Programming ?
0 Votes
Any Other Solution?
1 Votes