C++ Tutorial 2, Input And Variables
|
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
|
|
|
Ukraine: A Prospective Player On The World Software Outsourcing Market
The destruction of the Soviet Union about 15 years ago, made a huge country with a great level of IT science divided into small bricks. Nowadays, despite Russia's expansion into the world software development market, Ukraine keeps playing an important role here too. There are several prerequisites for this.PrerequisitesTraditionally, Ukraine always was a technical region of the USSR. No wonder, the IT education was and still is one of the most popular and respective education in the region. Such well-known Ukrainian universities as Kyiv National Technical University, Donetsk National Technical University etc. as well as new establishments with more innovative approach for IT specialists education, such as Donetsk State Institute of Artificial Intelligence and others, educate a new prospective generation of youn...(related: Software)
Edi: Electronic Document Interchange For Microsoft Great Plains ? Overview For Software Developer/pr
Microsoft Great Plains - Microsoft Business Solutions accounting and ERP system, originally targeted to mid-size - now, with advancements and increasing reliability of its database - Microsoft SQL Server, Great ...(related: Software)
How The Firefox: How To... Manual Helped Me
A few months back I really got sick of my computer always being slow and having system errors. So I started doing a bit of research and heard of a new browser called "Firefox".After a few months of going through it I started to see a huge difference in my computers performance and as a result in my own productivity online and off. This was a direct result of using the Firefox browser. So I then started to learn the features that came with it and I realized that this browser had A LOT more features than I had ever seen or used on any other browser. As I started to mention this to my co-workers and friends and family they all got interested in the browser and decided to install it on their own systems.Thats when the questions started.It didn't matter where I went, I ran into someone who had a question or questions on "How d...(related: Software)
Story Development Software: Good Or Evil?
In the early days of the personal computer, we're talking the mid-'80s here, there was speculation that someday books would all be writen by computers. It sounded a little too science-fictiony for most writers. After all, words on a page---no matter how well they appear to work together---are meaningless without the insights and experiences of the writer behind them.At this point in time, I'm happy to report, computers are not writing all our books for us.However, writing software has progressed far beyond the basic word processing abilities of Word and Word Perfect.Today, we have a wide variety of story development software. Most can be used to write novels or screenplay...(related: Software)
Lotus Notes Domino And Microsoft Crm Integration
Well, even if the combination might look very unusual, we see the coexistence of these two systems, especially in large corporations, non-profit organizations. Technically Lotus Notes Domino has parallel structure, including Domino email server. Lotus is extremely flexible and you can program your own CRM or purchase CRM for Lotus, however Microsoft CRM has Microsoft SQL Server database and very simple Sales automation module. Let's look at the integration reasons and scenarios. Be sure that each specific case requires custom programming, tuning and support.? Why Lotus & MS CRM? There are several reasons to combine the two. First ? Lotus Domino has very long history and i...(related: Software)
Great Plains Custom Development: Dexterity, Vba, Sql, Crystal, Econnect ? Overview For Programmer
Microsoft Great Plains is main Microsoft Business Solutions accounting package for the US market. It has multiple customization/modification/reporting tools. Currently there is upgrade campaign to version 8.0 and due to the discontinuation of the technical support for Microsoft Great Plains Standard on Ctree and Pervasive SQL - we see substantial increase in migration needs: migration from c...(related: Software)
Msn Messenger Is A Sweet Way To Communicate
MSN messenger is a pretty cool invention. I mean I'm not really into serious discussions on the email, answers to questions can often take a few days to arrive because people are so busy these days. I've just been 'hooked up' into Messenger and it's really a different kind of communication, quick, simplistic and even humorous with the capability to express your feelings with 'emotion' cartoons.With Messenger you can communicate with a group of close friends or business...(related: Software)
Microsoft Great Plains Reporting ? Overview For Developer
Looks like Microsoft Great Plains becomes more and more popular, partly because of Microsoft muscles behind it. Now it is targeted to the whole spectrum of horizontal and vertical market clientele. Small companies use Small Business Manager (which is based on the same technology ? Great Plains Dexterity dictionary and runtime), Great Plains Standard on MSDE is for small ...(related: Software)
Microsoft Business Solutions Products Selection: Erp, Crm, Retail Management
Let's first look at your ERP system selection (without Retail Solution). Your options are:Microsoft Great Plains. If you remember successful mid-size application ? Great Plains Dynamics, pioneered on Mac and Windows graphical platforms in the mid 1990th. This is now...(related: Software)
Microsoft Great Plains Jewelry ? Implementation & Customization Overview
Each Industry and market niche has business specific and unique requirements to ERP/Accounting System. Microsoft Business Solutions Great Plains is ERP platform, ready for third party modules additions and customizations, plus being SQL Server-based system it opens you wide spectrum of integration options and tools. In this small article we'll give you Microsoft Great Plains implementation and setup highlights, typical for Jewelry retail network.? Fixed Assets. Jewelry retailer owns the network of jewelry retail outlets and each one has relatively expensive set of fixed assets: counters, holders, computers, etc. Co...(related: Software)
site-map - Copyright © 2008 | Contact Webmaster | All Rights Reserved. | Software