Web Site Promotion | About | Contact | Web Design News |
Chicago Animation : Chicago Web Design - Go Back

C++ Tutorial 2, Input and Variables

 

Search Engine Specialist

search engine expert Free Internet Marketing consultings from ChicagoAnimation.
To use this free service please fill out the form below and we will call you to offer you free tips.

* First Name: * Last Name:
* Email Address: * Phone Number:
Street Address: City:
ZipCode: Your State (2 Letters):
URL (if available): Your Cell Phone #:
Company Name:
How long has your website been live?
What services or packages can we help you with?

How may we help you?
My current budget is. . .



This is the tutorial where we really get into programming. Input and variables are the essence of programming. In this tutorial you will learn how to get data from the user and use variables. You will learn the types of variables there are and how to do basic math with them. At first, this may seem boring and pointless, but you have to learn it, and it should go quick.

Basic Input
When you are making a console application, here is how you should get user input. Some of you may have guessed it, you use c[b]in[/b], of course, the 'c' meaning console and the 'in' meaning input, like 'cout'. So, here is a basic code, where the name of the variable x.cin>>x;

Defining Variables
A variable is what you guessed, a number or piece of data that will vary.

The diffrent types of variables:

bool - true or false
int - whole numbers
char - character (a, b, c, etc...)
string - multiple characters (words, etc..)
float,double - numbers that can have decimals

When deciding what type of variable to use, think about what kind of data it is going to be storing and remember that some data types use more memory than others, however most of your applications will use less memory than you have. To declare a variable, write the type of variable, then the name.

Examples:
int myInt = 7;
char thisChar= 'a', otherChar = 'b', char newChar;
string password= "password";

Syntaxes
Notice how I always had the first word not capatalized, but I capatalized all the other ones. You can also define more than one at a time, and you dont always need to set the value in the begining. Also, when you use a char, use a ' and for a string a ". Try to give your variables meaningful names.

Math
This is really the heart of programming, math! For now, we are going to be doing some simple arithmetic.

The basic math functions are:

+ = addition
- = subtraction
/ = division
* = multiplication

There are a bunch more, but that is all we need for now.

Go out and make a program!

Now that you know some of that basic stuff, try making a program, and dont be afraid to ask for help on http://www.syschat.com!

Chris Silop - http://www.syschat.com, Computer Forum

 

MORE RESOURCES:

TrustedReviews

Apple Recommends Antivirus Software For Mac OS X
InformationWeek, NY - Dec 2, 2008
What's more, Apple's products, such as its iTunes software, its QuickTime media player, and its Safari Web browser, have become increasingly popular among ...
Apple on the Need for Anti-Virus Software: Now You Do, Now You Don't Wired News
Apple Pulls 'Old' Antivirus Software Warning CIO Today
Apple suggests Mac users Install antivirus software CNET News
Apple Insider - Computerworld
all 238 news articles


COPsync Software Called Upon to Secure the Texas State Border
MarketWatch - 8 hours ago
a software technology provider to law enforcement and emergency service professionals, is pleased to announce that the State of Texas, Division of Emergency ...


Likewise Software Joins HP Developer & Solution Partner Program
MarketWatch - 10 hours ago
BELLEVUE, Wash., Dec 03, 2008 /PRNewswire via COMTEX/ -- Likewise Software, the leader in delivering open source audit and authentication for mixed networks ...


Lagan Expands Board of Directors with Software Industry Veteran ...
MarketWatch - 14 hours ago
McKay brings over 25 years of experience building and leading world class software and services companies. As President and CEO of Watchfire from 2001 ...


McAllister Software Systems(R) Announces Release of AVImark ...
MarketWatch - 15 hours ago
PIEDMONT, Mo., Dec 03, 2008 /PRNewswire via COMTEX/ -- McAllister Software Systems, Inc. announced that version 2009 of AVImark, which will be available at ...
McAllister Software Systems(R) Announces Release of AVImark ... International Business Times
McAllister Software Systems(R) Announces AVImark(R) Integration ... MarketWatch
all 16 news articles


RTT News

Software maker Adobe to lay off 600 workers
San Francisco Chronicle,  USA - 4 hours ago
Narayen said the chief cause of Adobe's problems is weaker than expected demand for the company's latest software, Creative Suite 4, which began shipping in ...
Adobe slashes revenue forecast Financial Times
Adobe to cut 600 jobs, report lower fourth-quarter revenue SiliconValley.com
Adobe Revenue Forecast Trails Analysts’ Estimates (Update1) Bloomberg
Reuters - San Jose Mercury News
all 92 news articles


TrustedReviews

Nokia's OSS strategy gets boost as Symbian deal completed
Ars Technica, MA - 23 minutes ago
The foundation's software will be made available royalty-free to members early next year. After the software is audited to ensure that there are no ...
Nokia Acquires Symbian Limited MarketWatch
Maximizer CRM Maximizes Reach with Symbian OS Deal TMCnet
Nokia acquires Symbian Straits Times
TG Daily - MarketWatch
all 96 news articles


Emerging Markets Hold Potential for World Retail Software Markets ...
MarketWatch - 16 hours ago
New analysis from Frost & Sullivan ( http://www.kiosks.frost.com), World Retail Software Market, finds that the retail software market earned revenues of ...


Adaptive Planning Wins Prestigious Software Satisfaction Award for ...
MarketWatch - 15 hours ago
This honor, awarded by Sift Media and presented by Finance Week, was established to reward high standards from software application providers serving UK ...


SAFE Corporation Releases SourceDetective, Internet Search for ...
MarketWatch - 15 hours ago
SAFE-corp.biz), the leading provider of software tools for detecting and measuring software intellectual property, has just released SourceDetective(TM), ...

Software - Google News

ChicagoAnimation's Acquisitions: Market Polls - 1pennyStock.com
Sponsors: Paving | VTL's | Religious Statues