+ 1

do i have to add #include<iostream> using namespace std after every {} block

i know these are dumb questions sorry

14th Jan 2017, 5:24 AM
jonathin
3 Respostas
+ 5
just include it once at the top of ur file #include <iostream> using namespace std; //All ur code here
14th Jan 2017, 5:33 AM
Kawaii
Kawaii - avatar
+ 4
no. you only have to (and should) include files once. There is actually two lines of code in your question. each line performs a seperate function. #include<iostream> #include 'includes' the file specfied in < file > or " file.h" so basically the file gets typed in front of what you write. and then there is using namespace std; Using namespaces allows you to reference functions within the namespace without qualifiers. name spaces are a good way to seperate your code but yeah. google namespaces c++.
14th Jan 2017, 5:27 AM
jay
jay - avatar
0
Not really , there are also file specifics such as #include <string>.
1st Feb 2017, 9:23 PM
Tails Ex Machina
Tails Ex Machina - avatar