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
express cleaning service Arlington Heights ..Are you ready? SQL Server 2005, the next-generation data management... Read More
Some introduction into Great Plains Software products, now Microsoft Business... Read More
When you need a phone number, you do a quick... Read More
Java has come along a long way. Many would agree... Read More
The world of small business accounting software can be a... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
Microsoft Great Plains fits to majority of industries, in the... Read More
In the previous ISDN article, we looked at how and... Read More
We all already got used to computer monitoring both at... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
After seeing many people complain about their weak Internet security... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Microsoft Business Solutions Great Plains was historically designed to serve... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Just imagine: you are walking, say, towards your car, and... Read More
I've been active in the Cisco Certification track for four... Read More
Our opinion is based on our Microsoft Business Solutions Great... Read More
Most computer users use spreadsheets software such as Microsoft Excel... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Business Solutions Great Plains, Solomon, Navision, Axapta, Microsoft CRM... Read More
Research bears that less than 70 percent of development projects... Read More
The vast majority of us will have, at some point,... Read More
To all web designers out there, this article is for... Read More
If there still are few unprotected computers left, I haven't... Read More
tidy up service Arlington Heights ..Beginning with Domino version R4 it has integration with the... Read More
One of the main reasons business owners and entrepreneurs use... Read More
2005 ? Back to the Future.What does the future hold?... Read More
Lotus Domino/Notes ? Microsoft Great Plains tandem as ERP with... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
This short paper will expand on two key reasons to... Read More
Just when you thought you were Web savvy, one more... Read More
Microsoft Great Plains may be recommended for international freight forwarding... Read More
Microsoft Great Plains has substantial mid-market share in the USA... Read More
It???s easy to understand why you might be drawn to... Read More
Make-or-Break Factors in Success and ProfitabilityFor quick printers, estimating can... Read More
"Pfishing", sometimes spelled "Phishing", is a word that's used to... Read More
Microsoft CRM was designed to be easily customizable. Microsoft CRM... Read More
If you've been using MySQL database to store your important... Read More
Running Applications in Compatibility Mode With Windows XP, you can... Read More
IBM Lotus Domino or Microsoft Exchange?The severe competition continues for... Read More
In today's business world it's all but impossible to escape... Read More
Although statistics often is blamed for various deadly sins --... Read More
I have always regretted how Microsoft price gouges and rips... Read More
Introduction: The creating of a computer program involves a number... Read More
Microsoft Word is one of the most popular office applications... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
RSS (Really Simple Syndication) is a way for a site... Read More
Microsoft Business Solutions is emerging as very attractive vendor for... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
Software |