EDIT: Thanks for the reply! must sound like im really impatient huh? sorry. will try that.
Okay, I've cleaned up my code just a tiny bit but it seems as though no one is interested in helping me out here?
So how about instead of asking you to go through all that (nasty) newbie's code I ask you a better way to truncate a float type variable to the decimal point?
I've just been doing it just by converting it to an int type but its really messy and complicates things up. Maybe its the source of my problem as well?
So anyone know a better way to do this? Any responce appreciated much. Thanks!
Here is the cleaner code:
Code:
#include <stdlib.h>
#include <iostream>
using namespace std;
int deg(float input);
int min(float input);
int sec(float input);
int deg(float input)
{
int degrees = input; //conver to int to truncate
return degrees;
}
int min(float input) // same thing, formula for minutes
{
int in = input;
float deci = input - in;
int minutes = deci*60;
return minutes;
}
int sec(float input) //same, get seconds
{
int in = input;
float deci = input - in;
float semi = deci*60;
int minutes = semi;
float b = semi - minutes;
int seconds = b*60;
return seconds;
}
int main()
{
float input = 0;
cout << "Enter measure of angle in degrees: ";
cin >> input;
cout << endl << deg(input) << " degrees " << min(input) << "' " << sec(input) << "'' " << endl << endl;
system("PAUSE");
return 0;
}
Again... thankyou.... in advance....