0
I dont get any of this or how it correlates i
i know how to write the simple code but my mind doesnt know what is really doing
3 Answers
+ 1
im gonna have re read this but i understood ypur beggining
0
Let's just take step by step
1. what ? i want to add two numbers
2. how ?
me : hey compiler i want to add two numbers
compiler : okay first you need to include header files like this
#include <iostream.h>
and then you need to use functions and objects written in those headerfl files
me : okay but what are those functions and objects
compiler : okay for starters all you need to know how to take input and output for that you need write like this :
cout <<"Hello im new to programming ";
#print something on screen using cout object
cin >> number ;
#take input from user using cin object
me : okay but i want to know how to add two numbers
compiler : okay so far you know how to add header files and use functions and objects written in it
now you need to know that their is main gate or more clearly main function where main execution of program starts..it look like this
int main ()
{
}
me : ohhk i got that now what
compiler : now apply your logic like in main function like this
take vaiable a and b to add two numbers and save it into third variable like this
# int a, b, c;
# c = a + b;
me : ummmm..something like this
#include <iostream.h>
int main ()
{
int a,b,c;
cout <<"/n Enter the value of a : ";
cin >> a;
cout <<"/n Enter the value of b : ";
cin >> b;
c = a + b;
cout <<"Addition of two numbers " << c;
return 0;
}
compiler : GOOD JOB you've just made your first program now you know how to work around programming now.
- 1
I think is perfect though am not c++ programmer