FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!

How to use an if statement




if is a conditional statement, you used if statement if you u need to have a condition in your program.

if statement syntax

if (condition) {
statement(s)
}

here a sample program

#include <iostream>
using namespace std;

int main() {
float grade;
cout << "Enter your grade: ";
cin >> grade;
if (grade >= 75) {
cout << "passed";
} else cout << "failed";
system("pause");

}



2 blog comments below

Glad to have found your blog... just the information I need... Will be bookmarking you Very Happy
GuidanceReader on Fri Dec 30, 2011 3:02 am
Nice Job.
But I'm expecting more from you.
If you explain line by line,that would be better.
This will helpful newbies.
cybersa on Fri Dec 30, 2011 12:58 pm



FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.