Skip to content

Commit

Permalink
Merge pull request #83 from yashrajmani/main
Browse files Browse the repository at this point in the history
added OOPs basic code
  • Loading branch information
prathamesh-borse authored Oct 24, 2021
2 parents a0fa380 + 7772273 commit c813d0a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions C++ Programs/01_class_obj.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <iostream>
using namespace std;

class car
{
char col[10];
public:
int speed;
void get(int distance, int fuel)
{
cout << "the car has DISTANCE :" << distance << "FUEL :" << fuel << endl;
}
void milage(float distance, float fuel);

void carspeed()
{
cout << "SPEED " << speed;
}

} audi;

void car ::milage(float d, float f)
{
float carmil = d / f;
cout << "MILAGE IS :" << carmil << endl;
}

int main()
{
car swift;
swift.get(10, 10);
audi.get(19, 20);
audi.milage(1900, 20);
swift.speed = 10;
swift.carspeed();
return 0;
}

0 comments on commit c813d0a

Please sign in to comment.