Compiling error

Sep 1, 2010 at 8:13pm
During the past week i've been trying to learn c++. Yesterday I tried using somebodies guide on youtube but when I try to compile and run the script I get the errors :

Iostream : No such file or directory
Iomanip: No such file or directory
error: syntax error before "namespace"
warning: data definition has no type or storage class

In function 'main'
error: cout undeclared, first use in this function
warning return type of 'main' is not 'int'

my code is
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
//Programmer: Nazmus
//Program: Temperature Table Display

#include<iostream>
#include<iomanip>

using namespace std;

void main()
{
float celsius, fahrenheit, kelvin;

cout << setw(15) << "Celsius" << setw(18) << "Fahrenheit" << setw(15)<< "Kelvin" <<endl;

for(celsius=0;celsius<=100;celsius=celsius+10){

fahrenheit = (9/5.) * celsius + 32;
kelvin = celsius + 273.;

cout << setw(15) << celsius << setw(18) << fahrenheit << setw(15)<< kelvin << endl;
}

system("pause");

}


Nazmus sent me the code and it works for him, i dont know why it doesnt for me. Can anyone tell me if anything is wrong im using Code::Blocks 10.05. Thanks everyone
Sep 1, 2010 at 8:16pm
Did you install the compiler and the standard library?
Sep 1, 2010 at 8:17pm
Don't you need a space between include and <iostream> etc
Sep 1, 2010 at 8:49pm
Bazzy, i just downloaded codeblocks how do i install the standard and other libraries
Sep 1, 2010 at 8:53pm
Did you install codeblocks + compiler or only codeblocks? what OS are you on?
Sep 1, 2010 at 9:06pm
I have coeeblocks and compiler since the hello world code works, and im using windows vista 64
Sep 1, 2010 at 9:39pm
If you delete all the code above and compile the hello world, does it work?
Sep 1, 2010 at 9:46pm
Yes if i do the hello world it still works it must be a problem with this code
Sep 1, 2010 at 9:49pm
I mean if you replace the code above with the hello world in the very same file
Topic archived. No new replies allowed.