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
detailed home cleaning Park Ridge ..With thousands of web pages added to the Net every... Read More
Rapid Application Development (RAD) is a software development methodology. In... Read More
Former Great Plains Software Dynamics/eEnterprise, and currently Microsoft Business Solutions... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
With many manufacturing shops heading over seas in favor of... Read More
Did you ever want to erase everything on your computer?... Read More
ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More
If you look back to the history, you will see... Read More
Do you want to get quality software at a reasonable... Read More
Finally, you have some time to personalize your desktop with... Read More
Designing without tables by using CSS layouts is fast becoming... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
Microsoft SQL Server is the leader for inexpensive and middle... Read More
It is now common thing when large corporation selects mid-market... Read More
Security flaws have long plagued Internet Explorer (IE), the market-dominating... Read More
With so many Microsoft Windows related viruses, errors, and other... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
The major reason I recommend getting your hands on real... Read More
Once a business idea is selected, it is highly recommended... Read More
The software giants don't do everything and don't always produce... Read More
When it comes to screenplay software each screenwriter needs to... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
We are in a transition phase in the Managerial Administration... Read More
What is Interactive Mapping?Interactive mapping is a visual display medium... Read More
express cleaning service Des Plaines ..Introduction: The creating of a computer program involves a number... Read More
What is Snort?Snort is an open source network intrusion detection... Read More
For those who still don't know, Microsoft Publisher helps computer... Read More
If someone entered your home, uninvited and installed numerous cameras... Read More
Once upon a time not so long ago, there was... Read More
This article will not attempt to advocate the use of... Read More
Google Inc. has launched a new software package that allows... Read More
Spyware, what it is and what it does. Basically, spyware... Read More
#5 All your hardware components like Printers, PCs etc come... Read More
Microsoft Great Plains could be tuned and setup to fit... Read More
Simply put, fleet maintenance allows companies to monitor and maintain... Read More
Microsoft Great Plains, Navision, Solomon and Axapta are Microsoft Business... Read More
C++ Function templates are those functions which can handle different... Read More
And kill the best layout software in the process of... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics/eEnterprise... Read More
We all already got used to computer monitoring both at... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
There are two approaches for application integration:? Programmer's approach ?... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Every organization which creates collaborative documents, whether they are budgets,... Read More
Microsoft Great Plains is main accounting / ERP application... Read More
You probably didn't casually invite, or extend a formal attendance... Read More
Customer Relationship Management (CRM) is a strategy and processes used... Read More
Microsoft Great Plains is main Microsoft Business Solutions product, targeted... Read More
We've all seen the ads on TV for Netzero 3G.... Read More
Software |