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: 2. variables

About this Lesson

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

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

In this lesson we create a C++ program that requests the user to input distance and time, and then calculates the velocity.

The concepts covered in this video include: comments, include statements, iostream library, namespaces, the std namespace, cout, endl, variables, variable declaration, floats, cin, and using namespace command.

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 Two Ways of writing Comments in C++:

/* This is an example of
comment Type One. */

// This is an example of Comment Type Two

If you follow along with the lesson, by the end you'll have the following code. In the lesson the code is explained thoroughly and fully.

/*
* main.cpp
*
* Created on: Jul 7, 2009
* Author: TomorrowSoft
*/

#include <iostream>
using namespace std;

int main()
{
cout << "**************************" << endl;
cout << " Velocity Calculator " << endl;
cout << "**************************" << endl;
cout << endl;

// Variables
float Velocity, Distance, Time;

// Get Input From User
cout << "Enter Distance: ";
cin >> Distance;
cout << "Enter Time: ";
cin >> Time;

// Calculate Velocity
Velocity = Distance / Time;

// Output Velocity to Screen
cout << "Answer: Velocity = " << Velocity << endl;

return 0;
}

Embed this video on your site

Copy and paste the following snippet: