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
disinfecting cleaning services Winnetka ..Stealing company information used to be the specialty of spies... Read More
Stop the Runaway MouseWhat's the "runaway mouse?" You've seen it...you... Read More
Microsoft Business Solutions Great Plains has several options to enable... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Our hosted solution allow you to run your own search... Read More
Microsoft Great Plains is main mid-market application from Microsoft Business... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
The major reason I recommend getting your hands on real... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
Enabling Chinese input is quick and easy, there are only... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Some companies that are in need of fleet management may... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
.Net Framework is a platform or development environment to seamlessly... Read More
We would like to give you pluses and minuses of... Read More
Spyware is software or hardware installed on a computer without... Read More
If you have been running Windows XP for a couple... Read More
XML Server can be a Web Server that stores the... Read More
If you are in the market for new staffing software,... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Three highly respected names in Human Resources have joined forces... Read More
Anyone who has ever used Microsoft Word knows that it... Read More
TikiWiki is open source software - it is written in... Read More
last minute cleaning help Highland Park ..What is Colossus?Colossus is software licensed to about twenty-five insurance... Read More
User interfaces and accessibility are some of the most important... Read More
Mike Dunville* had a decision to make. As the new... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More
There are several kinds of software piracy. The bottom line... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
It is now common thing when large corporation selects mid-market... Read More
Well, even if the combination might look very unusual, we... Read More
People often ask me: What image file formats will Photoshop... Read More
Domino server is a buffer between the operation system and... Read More
Microsoft Outlook is one of the most widely used software... Read More
When Windows fails to boot it is normally caused by... Read More
While I was in college, if you would have asked... Read More
We were recently faced with a decision: either to let... Read More
As you probably know, when Microsoft purchased Great Plains Software... Read More
There are so many different programs that clutter up your... Read More
If you are to buy a HelpDesk & Asset Management... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Microsoft CRM is now on the scene and it is... Read More
OEComplete is a utility for managing the personal information of... Read More
Program Flow is what you think it is. How the... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Software |