PDF format
Links:
String class documentation
Ctype - character functions
Stof - this function may not be available to you
Point Plotter
Note: I posted an update to the Point Plotter this morning. It does the scaling for you so you can enter the raw data, and it will scale the data to fit. For drawing the circle, select "uniform scale." For other curves like sine waves, don't select "uniform scale" or one dimension will get squished. Updated point plotter.
// // main.cpp // Oct10 // // Created by Mark Brautigam on 10/10/16. // Copyright © 2016 Mark Brautigam. All rights reserved. // #include <iostream> #include <cmath> #include <string> using namespace std; string encrypt (string s) { string t = s; int len = t.length(); int i = 0; while (i < len) { if (isalpha (t[i])) { if (tolower (t[i]) <= 'm') t[i] = t[i] + 13; else t[i] = t[i] - 13; } i++; } return t; } int main(int argc, const char * argv[]) { string encrypted = encrypt ("Fourscore and seven years ago"); cout << encrypted << endl; string decrypted = encrypt (encrypted); cout << decrypted << endl; double PI = 3.1415926; /* int degrees = -180; while (degrees <= 180) { double radians = degrees * PI / 180; cout << degrees << " " << 100*sin(radians) << endl; degrees += 20; // degrees = degrees + 2; } */ // y = x^2 int x = -180; while (x <= 180) { int y = x * x * x; cout << x << " " << y << endl; x++; } /* string userInput = ""; double sum = 0; while (userInput != "done") { cout << "The current total is " << sum << endl; cout << "Please enter a number or /done/ when finished: "; cin >> userInput; if (userInput == "done") { break; } // n = userInput.stof(); sum += atof (userInput.c_str()); } return 0; */ }
No comments:
Post a Comment