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
best cleaning company Highland Park ..Hey Guys! Don't raise your eyebrows or fear by hearing... Read More
This article will not attempt to advocate the use of... Read More
Microsoft Business Solutions Great Plains serves multiple industries in the... Read More
When Great Plains Software introduced the first graphical accounting application... Read More
Is Photoshop CS2 worth the upgrade? You bet it is!... Read More
Customer Relationship Management, abbreviated "CRM," is the term for a... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Research bears that less than 70 percent of development projects... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
I suggest that you do not spend a lot of... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
User interfaces and accessibility are some of the most important... Read More
What is a Web Database?A web database is a database... Read More
Microsoft Business Solutions ? Great Plains is designed to meet... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
Are Spreadsheets Robbing your Enterprise of Competitive Advantage?'90% of "average"... Read More
Microsoft Business Solutions Great Plains has many years of successful... Read More
Great Plains Inventory Management (IV) module gives your business a... Read More
Whether you have used Microsoft Word for years, have just... Read More
C/SIDE (Client/Server Integrated Development Environment) - The core of... Read More
Microsoft bought Navision, Denmark based software development company, along with... Read More
Think of this, first we had the HAM Radio, then... Read More
Software development is a risky business.Many software developers are barely... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Not every software testing project can or should be automated.... Read More
high-end home cleaning Winnetka ..How would you like to prevent spyware and adware from... Read More
If you have been using the Internet for any amount... Read More
Just the thought of a duel-boot scares many people away,... Read More
C++ Function templates are those functions which can handle different... Read More
Once upon a time not so long ago, there was... Read More
Lotus Domino/Notes ? Microsoft Great Plains tandem as ERP with... Read More
Many Webmasters have never bothered to view their website's server... Read More
When it comes to running an office, the SOHO entrepreneur... Read More
Not every software testing project can or should be automated.... Read More
Do you want to get quality software at a reasonable... Read More
The COSMIC FP (function point) software quality metric, is no... Read More
In the early days of the personal computer, we're talking... Read More
Microsoft Retail Management (RMS) and Microsoft Great Plains are retail... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
Our hosted solution allow you to run your own search... Read More
I completed an experiment recently. I wanted to find out... Read More
Now there are Three Steps To Heaven Just listen and... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
The Internet is reshaping every form of communications medium, and... Read More
Just imagine: you are walking, say, towards your car, and... Read More
When making a decision to buy any piece of software... Read More
(1) Avoid using the same variable again and again for... Read More
We don't think about mainframe software pricing anymore, we just... Read More
Spyware is like the new technological nuclear weapon on the... Read More
Navision Software was purchased by Microsoft and now it is... Read More
Software |