18 lines
363 B
C++
18 lines
363 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
// program should read in a number and return 1/the number
|
|
|
|
int main(){
|
|
float ourNum;
|
|
cout << "Enter a number to invert: ";
|
|
cin >> ourNum;
|
|
if( ourNum != 0){
|
|
cout << "The inverse of that number is: "
|
|
<< 1/ourNum << endl;
|
|
}
|
|
else {
|
|
cout << "You can't invert 0, you jerk" << endl;
|
|
}
|
|
return 0;
|
|
} |