Hi! We show you're using Internet Explorer 6. Unfortunately, IE6 is an older browser and everything at MindBites may not work for you. We recommend upgrading (for free) to the latest version of Internet Explorer from Microsoft or Firefox from Mozilla.

Click here to read more about IE6 and why it makes sense to upgrade.

Learn to Program C++ Tutorial: 3. Decisions

About this Lesson

  • Type: Video Tutorial
  • Length: 12:08
  • Media: Video/mp4
  • Posted: 07/14/2009
  • Use: Watch Online & Download
  • Download: MP4 (iPod compatible)
  • Size: 20 MB

This lesson is part of the series: Intro to Programming in C++

Programs can make choices. In this lesson you'll learn how to code your program to make decisions. Learn how to use Relational Operators to make statements reduce to being either true or false. Learn how to use if statements to control what lines of code your program runs depending on the value of variables or statements.

If you don't already have a C++ compiler you'll need to watch the 1st video to get and setup a C++ compiler.

Click Here to view the compiler video:

http://www.mindbites.com/lessons/edit/4658-learn-c-tutorial-1-the-compiler

About this Author

Tomorrow Soft
Tomorrow Soft
3 lessons
Joined:
07/06/2009

Tomorrow Soft is a premier developer of video tutorials teaching everyday men and women the skills they need to start creating their own programs from scratch.

More..

Recent Reviews

This lesson has not been reviewed.
Please purchase the lesson to review.

Recent Comments

This lesson has not been reviewed.
Please purchase the lesson to review.
Be the first to comment on this lesson!

The List Of Relational Operands:

a > b Greater than
a < b Less than
a >= b Greater than or equal to
a <= b Less than or equal to
a == b Equal to
a != b Not equal to

Here's a Copy of The last program created in this lesson:

#include <iostream>
using namespace std;

int main()
{
// variables
int pounds;
int cost = 4;

// Ice Cream Store
cout << "**************************" << endl;
cout << " Ice Cream Store " << endl;
cout << "**************************" << endl;
cout << endl;
cout << "I'm selling ice cream." << endl;

// Get Pounds from User
cout << "How many pounds do you" << endl;
cout << "want? ";
cin >> pounds;

// print out a response
if( pounds < 4 )
cout << "that's not very much." << endl;

if( pounds >= 12 )
cout << "you'll get sick!" << endl;

cout << "that'll cost you " << endl;
cout << (pounds * cost) << "$" << endl;

return 0;
}

Embed this video on your site

Copy and paste the following snippet: