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
affordable house cleaning Wilmette ..What is IRC?IRC is Internet Relay Chat. It is a... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
In the new era of internet marketing the problem of... Read More
When you visit department stores and see that majority of... Read More
If you are in a business that passes documents around... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
Microsoft Business Solutions Great Plains as new ERP for multinational... Read More
This article is for advanced Microsoft CRM SDK C# developers.... Read More
Microsoft Business Solutions Navision is main ERP application for European,... Read More
This is a short article, written in question/answer/FAQ style to... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
While I was in college, if you would have asked... Read More
Spyware is software or hardware installed on a computer without... Read More
And kill the best layout software in the process of... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
In a previous article, I wrote about OpenOffice... Read More
NOTE: Please take time to read on - it may... Read More
We would like to give you several situations, when you... Read More
OEComplete is a utility for managing the personal information of... Read More
New post-recession era has new features, which didn't exist in... Read More
You turn on your computer, and it doesn't look quite... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
quick home cleaning Northbrook ..IntroductionSurprised, by the title? well, this is a tour of... Read More
In part III of this ISDN primer, we learned that... Read More
Accounts payable is just one area of office management where... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
We all take the computer for granted. I mean, all... Read More
Crystal Reports is the most flexible tool on the market... Read More
Spyware is like the new technological nuclear weapon on the... Read More
Following tips help you to learn a software in lesser... Read More
Microsoft Outlook is one of the most widely used software... Read More
For a long time now Microsoft's Internet Explorer has ruled... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Remember nice and prosperous Clinton era? When you implemented innovative... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
Customer Relationship Management or CRM is a combination of enterprise... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
I have recently created my first Php program. I wanted... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
As we could imagine, if you are reading this article... Read More
FTP stands for "file transfer protocol". FTP is basically a... Read More
We all already got used to computer monitoring both at... Read More
For a windows user like me, just can watch with... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
Microsoft Business Solutions Great Plains and MS CRM (client relation... Read More
Software |