heimsventus

2 dailies # 1,2,3,4, 6, 7,

Feb 8th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.16 KB | None | 0 0
  1. // ConsoleApplication1.cpp : Defines the entry point for the console application.
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <cstdlib>
  6. #include <ctime>
  7. #include <cmath>
  8. #include <string>
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13.     int width;
  14.     int length;
  15.     cout << "this program calculates area and perimeter, please enter in width" << endl;
  16.     cin >> width;
  17.     cout << "Now please enter in the length" << "\n";
  18.     cin >> length;
  19.  
  20.     int area = width* length;
  21.     int perimeter = length * 2 + width * 2;
  22.     cout << "area is " << area << "and perimeter is " << perimeter << "\n";
  23.  
  24.     cout << " this concludes Dailies 2 #1." << endl;
  25.  
  26.     double weight;
  27.     double height;
  28.     cout << "enter in weight" << endl;
  29.     cin >> weight;
  30.     cout << "enter in height" << "\n";
  31.     cin >> height;
  32.     double bmi = ((weight*.45) / (pow((height*.025), 2)));
  33.     cout << "your bmi is " << bmi << "." << endl;
  34.  
  35.     cout << " This concludes Dailies 2 and 3" << "\n";
  36.  
  37.  
  38.  
  39.     double start = 0.01, sum = 0.0;
  40.  
  41.     for (int i = 1; i <= 30; i++)
  42.     {
  43.  
  44.         start = start * 2;
  45.         sum = sum + start;
  46.  
  47.     }
  48.     cout << " The total for the penny compounded daily is " << sum << endl;
  49.     cout << " This is end of dailies 5." << endl;
  50.     system("pause");
  51.  
  52.  
  53.     double number1 = 0;
  54.     double number2 = 1;
  55.     double number3;
  56.     double times = 0;
  57.     cout << " Enter number of fibonacci numbers to generate." << endl;
  58.     cin >> times;
  59.     cout << number1 << ", ";
  60.     cout << number2 << ", ";
  61.     for (int i = 1; i <= times; i++)
  62.     {
  63.         number3 = number1 + number2;
  64.         cout << number3 << ",";
  65.         number1 = number2;
  66.         number2 = number3;
  67.  
  68.  
  69.    
  70.        
  71.  
  72.        
  73.     }
  74.     cout << "This is the end of dailies 6." << "/n";
  75.     cout << " Ask a question." << endl;
  76.     char question;
  77.     cin >> question;
  78.     string response;
  79.     srand(time(NULL));
  80.     int randomnumber = rand() % 5 + 1;
  81.  
  82.             switch (randomnumber)
  83.             {
  84.             case 1:
  85.                 response = "yes"; break;
  86.             case 2:
  87.                 response = "No"; break;
  88.             case 3:
  89.                 response = "Maybe"; break;
  90.             case 4:
  91.                 response = "You may find out later."; break;
  92.             case 5:
  93.                 response = "This shit ain't random."; break;
  94.             }
  95.             cout << response << endl;
  96.  
  97.     cout << "This is the end of dailies 7." << endl;
  98.  
  99.     system("pause");
  100.     return 0;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment