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
maid service near Lake Forest ..Most people understand that the "hardware" part of their computer... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
This is the tutorial where we really get into programming.... Read More
A UNIX Shell is in simplest terms, a command line... Read More
Let's first look at your ERP system selection (without Retail... Read More
If you are software developer or database administrator - we... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
We'll give you non formal view, based on our consulting... Read More
Microsoft Great Plains has full-featured Manufacturing suite of modules: Capacity... Read More
Before September 1995, Microsoft Windows was an MS-DOS program. DOS... Read More
When you think... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
Case study: A secretary using Corel WordPerfect 7 is often... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
.NET platform does not support multiple inheritance. Do not confuse... Read More
In order to implement VLANs in a network environment, you'll... Read More
Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More
The first topic we are going to discuss... Read More
Fundraising software lets you connect with donors in a way... Read More
Bad News - the Threat is Bigger than it SeemedHow... Read More
Are Spreadsheets Robbing your Enterprise of Competitive Advantage?'90% of "average"... Read More
top rated cleaning service Des Plaines ..You might think you don't need a firewall... Read More
Microsoft Retail Management System serves retail single store as well... Read More
Microsoft Business Solutions Great Plains might be considered as ERP... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
Icons are used everywhere; right from software applications, to internet... Read More
Remember old good days when your company probably had Great... Read More
With thousands of web pages added to the Net every... Read More
In this short FAQ style article we would like to... Read More
While Adobe is the most known maker of PDF tools,... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
What is Spyware?Spyware monitors your surfing habits and sends the... Read More
Imagine something that follows you home and sets itself up... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft CRM is winning market share step-by-step from such the... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
When Great Plains Software was designing and developing Great Plains... Read More
Corporate ERP/MRP selection might be tough one, especially considering very... Read More
Vince Lombardi once said that, "The achievements of an organization... Read More
In the new era of internet marketing the problem of... Read More
Need software to record your voice, streaming audio or musical... Read More
It's not very often I get excited about a software... Read More
In order to meet regulatory and corporate compliance requirements reporting... Read More
Remember back in the days where screensavers were the coolest... Read More
Software |