+ 1
What is the difference ?
int a=2 , b=3 // for example and int a,b cout<<" enter the 2 numbers"; cin>>a>>b ????
4 Answers
+ 4
well they might be giving same output. in first example the no have same value and can be changed on the source code inside ide but the second one is better
0
in the first you have initialised the value, and you can't change the value of variables for every program run.
In the second one, input is provided at runtime which kind of makes it flexible.
0
can u plz give an example !! so i can make it more clear ??
0
See when you write "cin>>a>>b" you are entering the numbers after the program runs,i.e you can input any no and it will take those values.
whereas in the first case, you have given the value a=2,b=3 before the program executes. you will have those values of a and b every time you run it.



