Error in this code? [c++]

Oct 19, 2013 at 2:54pm
Can anyone find the errors in this code?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
using namespace std;

int main()
{
	double number, half;
	cout << "Enter a number and I will divide it\n";
	cout << "in half for you.\n";
	cin >> number;
	half =/ 2;
	cout << fixedpoint << showpoint << half << endl;
	return 0;
}
Oct 19, 2013 at 3:13pm
Is double part of the iostream library? I'm on my cell and I'm pretty noob so I don't know for sure, but try to add this after your iostream:
#include <math.h>

Also, fixedpoint and showpoint are not defined...
Last edited on Oct 19, 2013 at 3:13pm
Oct 19, 2013 at 3:27pm
You wrote half =/2; in line 10, I think what you meant was half = number / 2;
Also, in line 11, use "fixed" not "fixedpoint"
Oct 19, 2013 at 6:47pm
@belgarionriva

I really do think double is part of iostream library isn't it?

can anyone enlighten please?
Oct 19, 2013 at 7:06pm
double is a built in type
Topic archived. No new replies allowed.