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
apartment cleaning near Highland Park ..Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
Microsoft Great Plains serves majority of US based horizontal and... Read More
This tutorial covers OLAP solutions used by Data warehouses and... Read More
Anti-virus software is used to find, remove or fix files... Read More
Crystal Reports is the most flexible tool on the market... Read More
Microsoft Business Solutions main middle market ERP application - Microsoft... Read More
Upgrading. Downtime. Maintenance. Hardware obsolescence. Implementation issues. The litany of... Read More
How do you run a program on a remote server... Read More
This article will not attempt to advocate the use of... Read More
Features Additionally, Vista will include many other new features.Aero Vista... Read More
I started using PIP (Picture It Publishing) Platinum 2002 right... Read More
Table of Contents1) Introduction 2) Related Work 3) Framework 4)... Read More
While Ukraine is becoming a new popular IT outsourcing destination,... Read More
Several software companies design programs for preventive maintenance. Most of... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
The Windows Indexing Service provides you with the ability to... Read More
The Software 2005 conference is now a wrap. This conference,... Read More
Find out why Spyware Removal from computers is important and... Read More
Microsoft Great Plains, former Great Plains Software Dynamics / eEnterprise... Read More
In the new era of internet marketing the problem of... Read More
I've been active in the Cisco Certification track for four... Read More
Are you one of those people that keeps track of... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
Let's say that you have a software project that's under... Read More
SAP Inc., a global leader in client/server enterprise application software... Read More
cleaning lady near Arlington Heights ..I suggest that you do not spend a lot of... Read More
If you have Microsoft Great Plains and support it for... Read More
In the previous ISDN article, we looked at how and... Read More
Microsoft CRM has built-in conversion tool, however you should probably... Read More
Now is the time to look at an alternative to... Read More
Bar charts, bar graphs, and any other chart or graph... Read More
Bill of Lading is required report for Logistics and Freight... Read More
Microsoft Business Solutions CRM proved to be reliable solution in... Read More
Microsoft Great Plains fits to majority of horizontals and retail... Read More
Microsoft Outlook is one of the most widely used software... Read More
In the new era of internet marketing the problem of... Read More
RSS (Really Simple Syndication) is a way for a site... Read More
Several years ago Microsoft purchased Great Plains Software, then Navision... Read More
Preventive Maintenance (PM) is defined as scheduled work done on... Read More
Software Engineering is the Systematic Approach for analysis design implementation... Read More
When you buy a computer, it most likely comes with... Read More
Microsoft Great Plains, former Great Plains Software Dynamics, eEnterprise has... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Fortunately one of the most common reasons cited for the... Read More
Manufacturing in the USA is far away down from mid... Read More
It is a well known fact that Java as a... Read More
(1) Avoid using the same variable again and again for... Read More
Whether you need to close a sale, gather end-user feedback,... Read More
... Read More
ERP Consulting industry is on the way to serve clients... Read More
Software |