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

maide service in Park Ridge ..
In The News:

Scammers create fake Evite invitations that mimic legitimate event emails, requiring users to verify senders and use antivirus software for protection.
The new Apple Watch hypertension feature passively monitors blood pressure patterns over 30 days using sensors to detect chronic high blood pressure signs.
Chrome extension spyware disguised as a free VPN service highlights security risks after it captured private browsing data from trusted sites.
New research shows how fatty acids in cooking oil can safely dissolve and recover silver from circuit boards without harmful chemicals or environmental damage.
The Fox News AI newsletter gives you information on the latest AI technology advancements, and about the challenges and opportunities AI presents now and for the future.
Anthropic investigates alarming AI abuse case where hacker automated entire cybercrime campaign using Claude, stealing sensitive data from defense and healthcare firms.
TikTok, Meta and YouTube restrict Charlie Kirk shooting videos with age gates and warnings while X faces criticism for allowing continued circulation.
Cybercriminals use fake troubleshooting websites to trick Mac users into running terminal commands that install Shamos malware through ClickFix tactics.
San Francisco startup Fable launches Showrunner, an AI platform dubbed the 'Netflix of AI' that generates animated episodes from text descriptions with Amazon support.
Apple raised iPhone prices for some models despite receiving tariff relief from President Donald Trump, with the new lineup starting at $799 for the base model.
A two-story 3D concrete printed home in Western Australia demonstrates faster construction methods that could reshape American housing amid rising costs.
Credit scores remain important during retirement for insurance rates and housing applications, while seniors become prime targets for identity theft and financial scams.
Scammers now send unexpected packages with QR codes that redirect victims to fraudulent websites or download malicious software to steal sensitive information.
Meeting AI tools record private conversations alongside work discussions, creating privacy risks that can be managed with proper settings and awareness.
Hotel privacy concerns are valid but rare, with methods to detect hidden tech using smartphone flashlights, mirror tests and scanning apps.
Improve your Wi-Fi speed and reliability with 10 simple router optimization tips that don't require special apps or expensive subscriptions.
A Columbia University breach exposed names, Social Security numbers and academic records of nearly 869,000 people, with notifications beginning in August.
Rental car drivers use AI-powered apps like Proofr to protect themselves from unfair damage fees as major companies deploy automated inspection tools.
Fox News' AI newsletter brings you the latest on technology advancements around artificial intelligence.
OnTrac data breach between April 13-15, 2025, exposed personal information of over 40,000 people including Social Security numbers and medical records.
A woman named Wika announces her engagement to an AI chatbot sparking worldwide debate about virtual relationships and technology.
The notorious people search site National Public Data relaunches despite a previous breach affecting 3 billion individuals, raising fresh privacy concerns.
Revolutionary TRAUMAGEL gel controls life-threatening bleeding from gunshot wounds and traumatic injuries, helping first responders prevent prehospital deaths.
Protect your home network by enabling proper encryption, creating strong passwords, checking connected devices and using VPN and antivirus software.
The Navy's solar-powered Skydweller drone flew nonstop for 73 hours in Mississippi, proving renewable energy can power long-endurance military missions.

QuarkXpress Tips: How to Move Content Between Print and Web Layouts

Since its release in 1987, QuarkXpress had made an immediate... Read More

Software Automation Helps Increase your Bottom Line

When you own a small business, time is money. And... Read More

Great Plains Dexterity ? Microsoft Great Plains Customization Overview

Microsoft Business Solutions Great Plains, former Great Plains Software Dynamics... Read More

How to Make Own CMS

Every day millions of new web documents emerge on the... Read More

Helping Newbies Understand Professional Software

The Windows registry is a huge database that ensures normal... Read More

Microsoft RMS Customization ? PO Items Receiving in Great Plains

Microsoft Retail Management (RMS) and Microsoft Great Plains are retail... Read More

Lotus Notes Domino and Web: Application Development ? Tips for Programmers

Beginning with Domino version R4 it has integration with the... Read More

Corporate ERP: Standard vs. Rich functionality ? Microsoft Great Plains

Traditionally we were considering functionally rich systems, such as SAP,... Read More

Microsoft Great Plains - Microsoft RMS Integration ? overview

Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More

Great Plains Dynamics/eEnterprise Upgrade ? Things to Consider and FAQ

If you have Great Plains Dynamics/eEnterprise (version 6.0 or earlier)... Read More

Microsoft eCommerce Web-development: Great Plains eConnect .Net ? Highlights for Programmer

In our small article we'll consider Microsoft Business Solutions Great... Read More

SQL scripts for Project Accounting: Microsoft Great Plains series ? overview for developer

Microsoft Business Solutions Great Plains has Project Accounting module where... Read More

Beware of Spyware

One day, you suddenly realize that your computer started to... Read More

Corporate ERP Selection: Microsoft Great Plains

In our opinion, traditional approach when you select ERP/MRP system... Read More

Reporting for Microsoft Great Plains/Dynamics/eEnterprise: RW ? ReportWriter ? Tips for Developer

Microsoft Business Solutions Great Plains is written in Great Plains... Read More

Cisco Certification: Introduction To ISDN, Part V

The major reason I recommend getting your hands on real... Read More

Scrap Booking Online: Word Perfect or Corel Graphics Suite?

Scrapbooks are very popular these days. I think that almost... Read More

Microsoft Great Plains Installation ? Overview for IT Director/Controller

Microsoft Great Plains is main mid-market application from Microsoft Business... Read More

Microsoft Great Plains ? Licensing & Product Versions

Current Microsoft Business Solutions Great Plains has more that 10... Read More

IT Department Skills to Support Microsoft Great Plains and Microsoft CRM

Microsoft Great Plains as ERP and Microsoft CRM as... Read More

Vlans

In order to implement VLANs in a network environment, you'll... Read More

Change Your Word Docs in Record Time!

Anyone who has ever used Microsoft Word knows that it... Read More

Who?s Watching What You Type?

If someone entered your home, uninvited and installed numerous cameras... Read More

Screenshots Vista Windows

Features Additionally, Vista will include many other new features.Aero Vista... Read More

Document Templates Give You The Perfect Framework For Your Documents

When it comes to running an office, the SOHO entrepreneur... Read More

after renovation cleaning Highland Park ..