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
disinfecting cleaning services Winnetka ..If you company is small or mid-size special products or... Read More
If you are to buy a HelpDesk & Asset Management... Read More
Microsoft has never released a service pack for Windows98 SE,... Read More
Not all of us have the luxury of working both... Read More
The research in the field of Natural Language Processing usually... Read More
Microsoft CRM is now on the scene and it is... Read More
Introduction to C++Why Learn C++?C++ may at first seem like... Read More
The COSMIC FP (function point) software quality metric, is no... Read More
Today's business world is fast-paced. No matter what it is... Read More
1. With mapping software you can create a report that... Read More
In part III of this ISDN primer, we learned that... Read More
Microsoft Business Solutions Great Plains is very generic accounting application... Read More
Microsoft CRM is new player on the CRM software... Read More
Have you ever noticed that when you look at your... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
The term "document management" and "paperless office" is the subject... Read More
What is installation in the language of technology? Installation... Read More
Current Microsoft Business Solutions Great Plains has more that 10... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
In the new era of internet marketing the problem of... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
... Read More
Microsoft Business Solutions CRM data conversion deserves FAQ type of... Read More
ERP Consulting industry is on the way to serve clients... Read More
IBM Lotus Notes Domino and Microsoft CRM (Client Relation Management)... Read More
last minute cleaning help Highland Park ..Microsoft Business Solutions Small Business Manager is scaled down Great... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
Google Inc. has launched a new software package that allows... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Your computer cost you from hundreds to thousands of dollars,... Read More
A few months back I really got sick of my... Read More
You would like to protect your documents, wouldn't you? Reasons... Read More
Do you remember that frustrating feeling when you find an... Read More
Disclaimer: All the thoughts expressed are my views only! Your... Read More
This article will not attempt to advocate the use of... Read More
Now that spyware is the single most dangerous threat to... Read More
Adobe Photoshop is one of the world's leading graphics editing... Read More
There are two approaches for application integration:? Programmer's approach ?... Read More
An integral part of any quality CRM system is lead... Read More
It could just be me, but my experiences with document... Read More
Are Spreadsheets Robbing your Enterprise of Competitive Advantage?'90% of "average"... Read More
Microsoft Great Plains is main Microsoft Business Solutions accounting package... Read More
This article is the first of a series of articles... Read More
You turn on your computer, and it doesn't look quite... Read More
It's all about turn times in the eMedia industry! The... Read More
We'll give you non formal view, based on our consulting... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
Bill of Lading is required report for Logistics and Freight... Read More
Software |