0
what is the use of include.h and # what does it indicate and what are loops eg for and i couldnt understand the concept till now
2 Answers
+ 5
1.include.h is a header file which has the definition of the functions like cout or cin
2. # is a preprocessor directives that means before any actual execution of program begins the complier runs these statements and includes header files or define macros.
3.loops are used when you have to run a certain set of statements multiple number of times
for eg:- i want to print natural numbers from 1 to 10
int main()
{
for (int i =1; i<=10 ; i++)
{
cout<<i<<endl;
}
return 0;
}
Here i have used "for" loop it has 3 parameters or inputs you can say. First is the declaration of variable that is incremented i.e. "int i=1" in my case this means my loops starts from 1. Next comes logical expression to be checked for executing loop i.e till i <=10 the loop will run. Last is the increment or decrement i.e. i++ it increases the value after loop has been executed i.e it will first assign 1 to i then check condition then execute loop and then increment i and again check statement.
REMEMBER: variable declaration and assignment of value is done only once at beginning of loop
+ 1
# is the begining of declaring headers (not only). They may be different. One allow you to use cout, some other - time(). You can write your own header and using.
Explane please, conception of what dont you understand,? loops?