Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. void readData (string fileName, vector<double> & flightPath, vector<double> & coLift) {
  9.     ifstream inSS;
  10.     inSS.open(fileName.c_str());
  11.     int i = 0;
  12.    
  13.     if (!inSS) {
  14.         cout << "File could not be opened" << endl;
  15.         exit(1);
  16.     }
  17.    
  18.     while (inSS >> flightPath.at(i)) {
  19.         inSS >> coLift.at(i);
  20.         i += 1;
  21.     }
  22.    
  23.    
  24.     flightPath.resize(i + 1);
  25.    
  26.     inSS.close();
  27.    
  28.     return;
  29. }
  30.  
  31. //double interpolation (double flightAngle, const vector<double> & flightPath, const vector<double> & coLift);
  32. //bool isOrdered (const vector<double> & flightPath);
  33. //void reorder (vector<double & flightPath, vector<double> & coLift);
  34.  
  35. int main() {
  36.     string fileName;
  37.     double flightAngle;
  38.     vector<double> flightPath;
  39.     vector<double> coLift;
  40.    
  41.    
  42.     cout << "Please enter wind tunnel data file name:" << endl;
  43.    
  44.     cin >> fileName;
  45.    
  46.     readData (fileName, flightPath, coLift);
  47.    
  48.     cout << flightPath.at(4) << " " << coLift.at(4);
  49.    
  50.    /* if (!isOrdered (flightPath)) {
  51.         reorder(flightPath, coLift);
  52.     }
  53.     // ==> Checks if vector is in order, if not it reorders it.
  54.    
  55.    
  56.     cout << "Please enter a flight-path angle:" << endl;
  57.    
  58.     cin >> flightAngle;
  59.     */
  60.    
  61.    
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement