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
best cleaning company Highland Park ..Microsoft Business Solutions Great Plains version 8.5, 8.0, 7.5, Great... Read More
The research in the field of Natural Language Processing usually... Read More
Remember back in the days where screensavers were the coolest... Read More
The first thing that you will notice about Linux Red... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
Intro This concise article will tell you in plain English... Read More
If you have Microsoft Great Plains and support it... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
When making a decision to buy any piece of software... Read More
How to delete the user? This is the first problem... Read More
Microsoft Business Solutions Great Plains is very good fit for... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
XML parser is a software module to read documents and... Read More
The purpose of Project Management Software is to provide an... Read More
Handling character strings in Java is supported through two final... Read More
If you are software developer or database administrator - we... Read More
We would like to give you pluses and minuses of... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
I've been active in the Cisco Certification track for four... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
Sometimes your PC will start acting strange for no apparent... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
high-end home cleaning Winnetka ..Pirated software is on the increase and now accounts for... Read More
Manufacturing in the USA is far away down from mid... Read More
The software giants don't do everything and don't always produce... Read More
You turn on your computer, and it doesn't look quite... Read More
Microsoft Business Solutions Great Plains as new ERP for multinational... Read More
Using professional icons in your application or website can bring... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
In this small article we will show you the possible... Read More
Logistics automation is often considered as barcoding extension to Sales... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
I completed an experiment recently. I wanted to find out... Read More
Microsoft CRM ? Client Relationship Management package from Microsoft Business... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Not every software testing project can or should be automated.... Read More
Background: For many organizations like ours, the interim target of... Read More
Are you a whiz at calculating financial information? Not the... Read More
The most important things you can do for your computer... Read More
Creating a new markup language.Introduction.General Reuse Markup Langauge, or GRML,... Read More
It won't matter how effective your WinRunner Team is if... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
There are many commands that are used in linux on... Read More
When reading an article where some term is used often,... Read More
Software |