• About Us
  • Classroom Training
  • Online Training
    • Self Paced Courses
      • Android Development for Beginners
      • HTML and CSS For Beginners (with HTML5)!
      • Javascript for Beginners
      • C Programming: iOS Development Starts Here!
      • Objective C For Beginners
      • PHP MySQL For Beginners
      • Web Development Code Camp
    • Live Instructor Courses
      • HTML and CSS with HTML 5 (Live)
      • Javascript for Beginners (Live)
      • C Programming for Beginners (Live)
      • Objective C for Beginners(Live)
      • Android Development Code Camp (Live)
      • iOS Development Code Camp (Live)
      • HTML5 & Advanced Client Side Development (Live)
      • Actionscript for Beginners (Live)
  • Forum
  • Testimonials
  • Contact Us
    • Actionscript
    • Android
    • C/C++/Objective C
    • HTML/CSS
    • iOS
    • Java
    • Javascript
    • PHP
Home > C/C++/Objective C > Learn C++ On the Mac: Primitive Variable Types

Learn C++ On the Mac: Primitive Variable Types

Posted by Mark Lassoff on September 13th, 2011 | No Comments

This is the second video in the Learn C++ on the Mac video series. In this video tutorial, Mark will show you how to declare variables in C++ as well as initialize them. The most common C++ Primitive variable types wil be discussed including int, double, float, bool and char.

Main.cpp

#include <iostream>
using namespace std;
 
 
int main (int argc, char * const argv[]) {
    char name;		//Declared the char variable called name
	name='M';		//Initialized the variable name
 
	cout<<"The value of name is: "<<name<<endl;
 
	int gameScore = 10900;		//Combined initalization and declaration
	cout<<"The score is "<<gameScore<<endl;
 
	//short int - 2 byte integer
	//long int- Bigger integer in some architectures
 
	bool isPlaying = true;		//boolean is a true or false value
	cout<<"Are we playing? " <<isPlaying<<endl;
 
	float gpa = 3.76;
	cout<<"My gpa was not " <<gpa<<"."<<endl;
 
	//Double is a more precise floating point variable
 
 
	return 0;
}

Leave a Reply

Click here to cancel reply.

Join our mailing list

Free video tutorials, course information and more!

* required

Email Address *

First Name

Last Name:

Email Marketing Software by VerticalResponse
Apple Store Facebook Google+ LinkedIn RSS Feed Twitter YouTube
Provided by The Social Links

Like Us!

Live Online Course

Online event registration powered by Eventbrite

Self Paced Course

What is ?

We train software, web and mobile developers. Our classes geared to the way adults learn are available online, or in-person at your office or training center.

New Android Book

Android Programming Code Camp by Mark Lassoff. Coming in 2012. Finally, a true beginners book on Android programming and development. No Experience required.

Email me when the book is available

On Learning

  • Top Languages Used in Web Development
  • How To Learn a Programming Language: 5 Tips
©LearnToProgram.tv 2012 .All rights reserved.