Hi.. welcome to my site in “We Are Knowledge” In here you
want getting many IT knowledge… likely IT knowledge about C++..
Now I want giving you IT knowledge about “C ++” and discuss
of “Tutorial using IF in C ++”…
Ok let’s do read my article…
If in C++ is condition which has been provided by C++ for
choice one from many options… if the condition is “true” then want to appear “value”
and if “else” want to appear “other value”..
Syntax IF :
if (condition) statement
Ok for more details, I want making program for you… check
this !!
Examle 1 :
you can copy this coding .
#include <conio.h>
#include <iostream.h>
main()
{
int d;
cout << "Input number 9 : " ;
cin >> d;
if (d==9)
{
cout << "Yes is right..Your input number "
<< d;
getch();
}
else
{
cout << "No is False.. Your input number "
<< d;
}
getch();
}
Then paste in your compiler.. likely borland C++..
And if it is ..
Press “alt + F9”
>> compile
Press “ctrl + F9” >> workingthe program
To result
If you input number 9 then
Input number 9 :
Yes is right..Your input number 9
If you input than the number 9 then
No is False.. Your input number (number your input)
Example 2:
you can too copy this coding in your aplication
#include <conio.h>
#include <iostream.h>
main()
{
int d;
cout << "Input number 8 or 9 : " ;
cin >> d;
if (d==8)
{
cout << "Yes is right..Your input number "
<< d;
getch();
}
else if (d==9)
{
cout << "Yes is right..Your input number "
<< d;
getch();
}
else
{
cout << "No is False.. Your input number "
<< d;
}
getch();
}
And if it is ..
Press “alt + F9”
>> compile
Press “ctrl + F9” >> workingthe program
To result :
If you input number 9 then
Input number 8 or 9 :
Yes is right..Your input number 9
If you input number 8 then
Input number 8 or 9 :
Yes is right..Your input number 8
If you input than the number 9 then
Input number 8 or 9 :
No is False.. Your input number (number your input)
Ok.. just it..
I hope you understand with my artiicle…
Don’t forget to back at my site…
See you later
No comments:
Post a Comment