Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję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
App doesnt work
4 Votes
Where can I write code for free
1 Votes
Project on HTML and CSS
2 Votes
Code Coach
2 Votes
Tutorial loop
1 Votes
Control Flow<<Time’s Up
0 Votes
Recent update issues?
1 Votes