-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdriver.cpp
83 lines (73 loc) · 1.93 KB
/
driver.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include<iostream>
#include<string>
using namespace std;
class Point
{
public:
double getX(); //accessor functions
double getY();
void setX(double xValue); //mutator functions
void setY(double yValue); //mutator functions
void move(double xamount, double yamount);// post-condition: new x value is x + xamount;
//new y value is y + yamount.
void rotate();
private:
double x;
double y;
};
int main() {
string myString;
myString = "hello there! i am your string.";
// Point myPoints[2];
// double userinput, movex, movey;
// cout << "Enter coordinates for two points." << endl;
// for(int i = 0; i < 2; i++)
// {
// cout << "Enter point " << i + 1 << "\'s x coordinate:";
// cin >> userinput;
// myPoints[i].setX(userinput);
// cout << "Enter point " << i + 1 << "\'s y coordinate:";
// cin >> userinput;
// myPoints[i].setY(userinput);
// }
// cout << "Move your point. Enter x and y amounts:";
// cin >> movex >> movey;
// myPoints[0].move(movex, movey);
// cout << "That point is now at" << myPoints[0].getX() << "," << myPoints[0].getY() << endl;
// cout << "I will rotate your 2nd point by 90 degrees.\n";
// myPoints[1].rotate();
// cout << "The new coordinates for your 2nd point are: " << myPoints[1].getX()
// << "," << myPoints[1].getY() << endl;
cout << myString << endl;
cout << myString.at(0) << endl;
cout << myString.find("i") << endl;
return 0;
}
double Point::getX()
{
return x;
}
void Point::setX(double xValue)
{
x = xValue;
}
double Point::getY()
{
return y;
}
void Point::setY(double yValue)//mutator function
{
y = yValue;
}
void Point::move(double xamount, double yamount)
{
x = x + xamount;
y = y + yamount;
}
void Point::rotate()
{
double temp;
temp = x;
x = y;
y = -temp;
}