Completely Stuck

Pages: 123
okay you need to correct couple of things.
n is your number that you enter.
hint n is your original input.
this is a mix number 21.19754329


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
#include <iostream> //used for cout and cin statements.
#include <string> //used for potential strings
#include <iomanip> //used for potential manipulation of data outcomes
#include <fstream> //needed for saving data file

using namespace std;

 //function prototype
int FracPart(float n); // float n is just a local variable in this function 
int WholePart(int x); // int x is just a local variable in this function.
// when you exit function it is destroyed with it local variables

int x; // not needed
int main()
{
float n;
cout<< "Please enter a mixed number with six or more decimal places. \n ";
cin>> n;
cout<<n<<" is the decimal number you have entered. \n";
cout<<FracPart(n); // just add  << endl; or << "\n"
cout<<"\n"; // then you can delete this.
cout<<WholePart(x); // required original input 
cout<<"]n";

}
int FracPart(float n) // this need to be rewritten
{
	int x;
	x=(n*(10*10*10*10*10*10))+(0.5);
	

return x;

} 

int WholePart(int x)
{
return x;
}
Last edited on
Thanks :] Got it working now.
Topic archived. No new replies allowed.
Pages: 123