Help with Real Numbers program

So I'm doing this thing for Math, to determine what class of Real numbers a number is (Rational, Integer, Irrational, etc.) and I really don't know how to set up the program. Here's what I have so far:

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
  #include <iostream>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    float x;
    char op;
    
    
    while ( op != 1 ) {
        cout << "Start program (1), exit (2)" << endl;
        cin >> op;
        switch ( op ) {
            case 1:
                cout << "Enter a number: ";
                cin >> x;
                cout << "That number is a: " << endl;
                if ( x == -x || x ) { //Don't know what I'm doing here...
                    cout << "That number is a real integer." << endl;
            
                    
                }
                
        }
    }
    return 0;
}


I don't know how to do the whole and natural classes though, is there any way to do something so the program detects positive/negatives?

Thank you.
Last edited on
Topic archived. No new replies allowed.