heimsventus

2 Dailies 1 through 7

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