Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- cout << "Give me the degrees to find some statistics results." << endl;
- cout << "In the following step, you have to write down the degrees and press enter to confirm.";
- cout << "In order to stop the process, you have to type '1000' or sth bigger than 1000. Of course this degree will not count in the statistics process." << endl << endl;
- vector <double> degrees = vector <double> ();
- double degree = -1000000;
- // The 1st value of degree is only to continue into the while-loop: This value is not passed in the vector, because the 1st thing going inside the loop is to read the user's input degree
- while(degree < 1000){
- cout << "Degree: ";
- cin >> degree;
- cout << endl;
- degrees.push_back(degree);
- }
- // After the end of the loop, we have such a big value (appropriate for the exit) and we have to remove it from the vector
- degrees.erase(degrees.end() - 1);
- for(int i=0; i<degrees.size(); i++){
- cout << degrees[i] << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement