@ Sudeep, Your code is Wrong because,
1. main() always returns a value 0 to the caller (OS) at the end if everything goes okay. which is why we use "int", because main() returns an integer value (0) to the caller. but void functions dont return any value.
2. This is c++ where you dont have to include the header files (that comes with the compiler) extensions. my minGW compiler complains about that.(most compilers will too)
yor using the "c" standard in c++.
3. you didnt include the std, not including it makes cout and endl undefined so the compiler shouts at that too.
4. You didnt put any return statement at the end of main(). the
return 0;
is for informing the caller that everything went fine, if not it returns another integer value. this is a very bad mistake, because the compilers dont give an error msg for not stating return 0;
Seems like your college is teaching the old standards of c++.