repl.it
@TheGman753/

C++11 calc

C++11

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <iostream>
#include <cmath>
#include <complex>
#include <cfloat>
#include <climits>
#include <cstdio>
#include <limits>
#include <cstdlib>
#include <time.h>
void line(),pause();
using namespace std;

int main()
{
  time_t curr_time;

  time(&curr_time);
  cout << "Made by TheGman753\nDate/Time: " << asctime(localtime(&curr_time));
  line();
  int a, b, c;
    cout << "Input A value\nInput: ";
    cin >> a;
    while(1)
    {
      if(cin.fail())
      {
        cin.clear();
        cin.ignore(numeric_limits<streamsize>::max(),'\n');
        cout << "Input a number\nInput: ";
        cin >> a;
      }
      if(!cin.fail())
      break;
    }
    cout << "Input B value\nInput: ";
    cin >> b;
    while(1)
    {
      if(cin.fail())
      {
        cin.clear();
        cin.ignore(numeric_limits<streamsize>::max(),'\n');
        cout << "Input a number\nInput: ";
        cin >> b;
      }
      if(!cin.fail())
      break;
    }
    cout << "Input C value\nInput: ";
    cin >> c;
    while(1)
    {
      if(cin.fail())
      {
        cin.clear();
        cin.ignore(numeric_limits<streamsize>::max(),'\n');
        cout << "Input a number\nInput: ";
        cin >> c;
      }
      if(!cin.fail())
      break;
    }
    line();
    cout << "\tEvaluations" << endl;
    pause();
    cout << "Quadratic formula: " << ((-1 * b) + sqrt(pow(b,2) - (4 * a * c))) / (2 * a) << ", " << ((-1 * b) - sqrt(pow(b,2) - (4 * a * c))) / (2 * a) << endl;
}

void line()
{
  cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
}
void pause()
{
  cout << "" << endl;
}
?