+ 3

can I use void main() instead of using namespace std

31st Jul 2016, 5:31 AM
Eyuwankg Swankg
Eyuwankg Swankg - avatar
5 Respostas
+ 4
no way if u don't want to right using namespace then u mention .h with header file like <iostream.h>
31st Jul 2016, 6:31 AM
Aman Ankur
Aman Ankur - avatar
+ 2
it's totally difirent , the void is just a data type of the function main and it return to nothing(like return 0 in int main) but you do not need to write the word return in void main. you can use std::cout/cin instead of using namespace std
31st Jul 2016, 6:17 AM
Đinh Nhật Thanh
Đinh Nhật Thanh - avatar
+ 1
hu, it's bad practice to use void man instead of int main
31st Jul 2016, 6:56 AM
Dorian
0
using namespace std; allows you to not need std:: in front of things like cout and endl, etc.
15th Jan 2017, 2:07 AM
Jesse Spurgin
Jesse Spurgin - avatar
0
No. void main (): is the function where the compilation and execution starts namespace std: was advanced version to use '.h'.
31st Mar 2017, 1:24 AM
Konduru. Chandana Sree
Konduru. Chandana Sree - avatar