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

spotless home service Deerfield ..
In The News:

Google, Dior, Allianz and dozens of other companies lost sensitive customer data in Salesforce-related breaches affecting millions of records across multiple sectors.
Apple launches iOS 26 with new Preview app that combines document editing, PDF annotation and scanning features into one streamlined iPhone experience.
New AI road monitoring system uses sensor-embedded fabric to predict infrastructure problems, potentially reducing maintenance costs and traffic disruptions for cities.
Holiday charity scams target retirees through lookalike organization names, untraceable payment requests, and data broker information to steal donations.
The Federal Trade Commission says criminals are posing as IRS agents, law enforcement officers or other officials, often over the phone or online, to steal thousands of dollars at a time.
AI phishing scams now use voice cloning and deepfake technology to trick victims, but Kurt "CyberGuy" Knutsson reveals warning signs to watch for.
Inversion Space unveils Arc, a reusable reentry vehicle that can deliver up to 500 pounds of cargo from orbit to anywhere on Earth in under an hour.
Red flags like processing fees, urgent countdowns and requests for full Social Security numbers expose fraudulent settlement sites targeting consumers.
Comprehensive analysis of Google Maps, Waze and Apple Maps examines usability, routing accuracy, data handling and features across the top navigation platforms.
Expert analysis reveals whether wired Ethernet or wireless Wi-Fi connections are safer for home internet use, plus practical steps to secure your network from attackers.
Australian construction robot Charlotte uses sand, crushed brick and recycled glass to 3D print fireproof, floodproof homes with reduced carbon footprint.
Cybercriminals are using fake invitation emails to trick recipients into downloading malware and stealing personal information and data.
Flying drones could help retailers fight a 93% increase in theft rates as Flock Safety promotes airborne security systems to track suspects and deter crime.
The Fox News Artificial Intelligence Newsletter brings you the latest news on the emerging technology every Saturday, highlighting top stories.
Hacker group Radiant stole data from 8,000 children at Kido nursery chain, demanding ransom and directly contacting parents with intimidation tactics.
As 18 states implement bell-to-bell cell phone bans, creative students use Google Docs, iMessage on MacBooks and Post-It notes to stay connected in class.
A sheriff's captain says deputies often spend hours writing reports between calls, but Axon's AI program, Draft One, helps them save crucial time in the field.
Sora 2, OpenAI's new video-generation app, can create AI-generated videos based on a singular prompt. The results are both mind-blowing and terrifying.
iPhone and Android users can reduce Wi-Fi calling battery drainage through settings adjustments, background app limits and stronger Wi-Fi connections.
Work email scams are becoming harder to detect as criminals use AI and spoofed addresses to trick employees into opening malicious attachments and links.
From her Arizona living room, Christina Chapman ran a covert hub that helped North Korean operatives infiltrate U.S. firms, netting $17 million in stolen salaries.
UC Santa Barbara researchers developed a soft robotic intubation system that achieved 100% success rates for experts and 96% for paramedics with minimal training.
Scammers exploit probate filings to target grieving families with fake fees and debts, Kurt "Cyberguy" Knutsson reports.
Automotive giant Stellantis becomes latest victim of widespread Salesforce breaches affecting companies like Google, Cisco and Adidas this year.
A woman from Washington reunited with her missing Maine Coon cat Louie after 11 days using Love Lost, a free AI-powered pet recovery platform.

Dig Out That Worm

Internet worms. Is your PC infected?If your computer has become... Read More

You Can Write Microsoft Office Program in About 60 Minutes

Microsoft Office program is a programming tool called Visual Basic... Read More

When is a Software Engineer Not a Software Engineer?

The title of "software engineer" has got to be among... Read More

Microsoft Great Plains RW: Report Writer

Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More

Microsoft CRM Integration with IBM Lotus Notes Domino ? Machinery Dealership Example

IBM Lotus Notes with Domino email server is traditional document... Read More

Microsoft Great Plains: Annual Enhancement Program ? How To Be Re-Enrolled

Microsoft Business Solutions Great Plains is mid and even corporate... Read More

Removing Incoming Email in MS Exchange, C# Example

The purpose of one of our projects was MS Exchange... Read More

C++ Tutorial 1, Introduction to C++

Introduction to C++Why Learn C++?C++ may at first seem like... Read More

Helping Newbies Understand Professional Software

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

Great Plains Dexterity Customization Options ? Overview For Developers

Looks like Microsoft Great Plains becomes more and more popular,... Read More

Microsoft Great Plains GL: General Ledger ? Overview For Consultant

Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More

Upgrading Great Plains Dexterity Customization ? switching to new technologies: SQL, Crystal, eConne

1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More

Twelve Things You Should Know to Save on Computer Software

Do you want to get quality software at a reasonable... Read More

Spyware Statistics -- Whats New in May 2005?

Although statistics often is blamed for various deadly sins --... Read More

Simple Solution for Php Includes - IFrames

I have recently created my first Php program. I wanted... Read More

10 Things You Can Do With Photoshop CS2 That You Couldnt Do Before Now

Is Photoshop CS2 worth the upgrade? You bet it is!... Read More

Oracle Development: JDeveloper 10G ? Java, J2EE, EJB, MVC, XML - Overview For Programmer

In 2004 Oracle, Inc. made its new step toward J2EE... Read More

Are You Waiting for Microsoft Longhorn Operating System

I love new technology. I am still ready to wait... Read More

It?s Back!! WordPerfect?s Amazing Comeback

Have you noticed WordPerfect is gearing up for a comeback... Read More

Microsoft CRM Integration with Microsoft Retail Management System (RMS) ? Overview

Microsoft Client Relation Management system (Microsoft CRM) and Microsoft RMS... Read More

Microsoft Great Plains Nationwide Remote Support

ERP Consulting industry is on the way to serve clients... Read More

How To Develop Software For Your Business

Software development is a risky business.Many software developers are barely... Read More

Best Spyware Removers

Finding the best spyware removers to detect and remove spyware... Read More

7 Things to Consider Before Buying Small Business Accounting Software

The world of small business accounting software can be a... Read More

Microsoft Great Plains Integration with Legacy Systems ? Overview For Developer

Looks like Microsoft Great Plains becomes more and more popular,... Read More

spotless home service Buffalo Grove ..