Whats wrong with my code, keep getting errors?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 void main()
{
	float input1;
	float input2;

	// Print request for first number, the read it in.
	cout << "Enter first number: ";
	cin << input1;

	// Print request for second number, then read it in
	cout << "Enter second number: "
	cin << input2;

	// Divide first number by second
	float result = input1 / input2;

	// Print result
	cout << "Result: " << result << endl;
}
Last edited on
1) Please use code tags: [code]Code goes here.[/code]
2) You should use int main()
3) cin << input1; should be cin >> input1;
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.

main must return int.

Input streams use >>
Thank you and sorry about format, new to the forum.
closed account (E0p9LyTq)
Is that all of your source code? Where is your #include <iostream> (or #include <iostream.h> )?
<iostream.h> is not a valid C++ header. It used to be decades ago, but not anymore.
Topic archived. No new replies allowed.