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
green cleaning service Glencoe ..How would you like to prevent spyware and adware from... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
For a windows user like me, just can watch with... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
Some companies that are in need of fleet management may... Read More
Microsoft Business Solutions CRM is web-based CRM application, deploying all... Read More
Looks like Microsoft Great Plains becomes more and more... Read More
Following tips help you to learn a software in lesser... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
C/SIDE (Client/Server Integrated Development Environment) - The core of... Read More
What is Software?Software is a set of instruction written to... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
(1) Avoid using the same variable again and again for... Read More
Corporate ERP/MRP selection might be tough one, especially considering very... Read More
Mike Dunville* had a decision to make. As the new... Read More
Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
There are so many different programs that clutter up your... Read More
Microsoft Business Solutions products: Great Plains, MS CRM, Navision, Axapta,... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
The Internet is reshaping every form of communications medium, and... Read More
In the early days of the personal computer, we're talking... Read More
Microsoft Business Solutions CRM is present several years on the... Read More
We live in a post-industrial age where information is the... Read More
As seeing large number of implementations ? in our case... Read More
house cleaning company Bannockburn ..As we could imagine, if you are reading this article... Read More
eStore Advantage allows front-office applications to communicate with back-office business... Read More
For a windows user like me, just can watch with... Read More
How to delete the user? This is the first problem... Read More
Let us give you - developer some hints in the... Read More
Microsoft Office program is a programming tool called Visual Basic... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
Midsize business or non-profit organization should decide if one-vendor solution... Read More
Enabling Chinese input is quick and easy, there are only... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Scrapbooks are very popular these days. I think that almost... Read More
Let's first look at your ERP system selection (without Retail... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
It would be easy to think, like most people apparently... Read More
With thousands of web pages added to the Net every... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
Sometimes your PC will start acting strange for no apparent... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Microsoft Great Plains fits to majority of industries, in the... Read More
Need help making sense of algebra? Have algebra lectures in... Read More
Microsoft Business Solutions CRM is now approaching the phase of... Read More
How would you like to prevent spyware and adware from... Read More
Software |