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
cleaning service near Bannockburn ..Microsoft Business Solutions Great Plains was purchased from Great Plains... Read More
Disclaimer: All the thoughts expressed are my views only! Your... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
As of now - Great Plains Dynamics/eEnterprise is transformed/renamed into... Read More
How many steps does it take you to locate and... Read More
TikiWiki is open source software - it is written in... Read More
Ad-Aware and Spybot are probably the two most well known... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Music downloads are off the charts! We're listening to digital... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
Passwords protect your most sensitive personal, financial and business information.... Read More
Spyware is software or hardware installed on a computer without... Read More
The fact that a software tester is a most infamous... Read More
IntroductionDuring the early years of our modern computer era, very... Read More
The vast majority of us will have, at some point,... Read More
It's no secret that software companies operate in a very... Read More
There are several kinds of software piracy. The bottom line... Read More
Microsoft CRM customization techniques are very diversified and based on... Read More
Three highly respected names in Human Resources have joined forces... Read More
Since Version 8.0 Microsoft Business Solutions Great Plains & Great... Read More
Mike Dunville* had a decision to make. As the new... Read More
pet-friendly home cleaners Mundelein ..Microsoft CRM is now on the scene and it is... Read More
If you've been using MySQL database to store your important... Read More
It won't matter how effective your WinRunner Team is if... Read More
Microsoft Retail Management System serves retail single store as well... Read More
Around the same time Microsoft made its move with .Net... Read More
Let us give you - developer some hints in the... Read More
GroupwareEfforts are continually made to manage the unavoidable ad hoc... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Stealing company information used to be the specialty of spies... Read More
Whether you are an experienced web programmer or a complete... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Some companies that are in need of fleet management may... Read More
MicroWorld Technologies, Inc. the leading solutions provider in the area... Read More
All your software is stored on a hard-drive. But how... Read More
Midsize business or non-profit organization should decide if one-vendor solution... Read More
I have always had a tendency to focus on the... Read More
If you have been running Windows XP for a couple... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
What is Software?Software is a set of instruction written to... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Software |