#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <fstream>
#include <sstream>
#include <vector>
 
using namespace std;
/* This is a simple example of a class that has data and functions */
class car {
public:
	double speed;
	double milage;
	void start() {
		speed = 0;
		cout <<"Vroom"<<endl;
	}
	void accelerate(double how_much) {
		speed += how_much;
	}
};
 
int main()
{
	car my_car;
	my_car.start();
	my_car.accelerate(5);
	cout << my_car.speed<<endl;
	my_car.accelerate(5);
	cout << my_car.speed<<endl;
	system("pause");
}
cs-142/cars.txt · Last modified: 2014/10/23 15:13 by kseppi
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0