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

disinfecting cleaning services Buffalo Grove ..
In The News:

Bipartisan AI jobs bill from Sens. Hawley and Warner would require companies to report AI-related layoffs and hiring to Department of Labor quarterly.
Joe A. from Shelton, Connecticut, lost $228,000 to a ZAP Solutions cryptocurrency investment scam after his divorce, highlighting rising online fraud.
AI-powered autonomous trucks from Waabi and Volvo target U.S. freight driver shortage with Level 4 self-driving technology and NVIDIA computing platform integration.
Survive flight disruptions with expert travel tips: Book early morning flights, download airline apps and know your refund rights during service cuts.
Apple's iOS 26.1 update delivers major security fixes, performance boosts and enhanced privacy controls for your iPhone. Discover why updating now protects your data.
Russian hackers use fake CAPTCHA tests to spread dangerous malware targeting governments and journalists. Learn how to protect yourself from these deceptive attacks.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Miami-Dade debuts America's first autonomous police SUV with AI cameras, drone deployment and real-time crime detection in groundbreaking law enforcement pilot.
Bank impostor scams cost Americans $2.9 billion as criminals use AI voices and caller ID spoofing to steal life savings. Learn nine essential fraud protection tips.
Foreign-owned apps secretly harvest personal data from seniors, making them prime targets for scams. Learn how to protect your privacy and stop data brokers today.
Sens. Josh Hawley and Richard Blumenthal introduce bipartisan GUARD Act to protect minors from AI chatbots through mandatory age verification and disclosure requirements.
Ghost-tapping scammers exploit wireless technology to drain accounts through small transactions, but RFID-blocking wallets and transaction alerts can protect you.
French pilot project demonstrates wireless charging roads that can deliver over 300 kilowatts of power to EVs while driving, potentially eliminating range anxiety.
YouTube's Ghost Network spreads information-stealing malware through thousands of fake videos offering cracked software, using compromised accounts and fake engagement.
Protect your privacy by disabling your smart TV microphone. Most TVs have hidden mics that listen even when voice commands are off. Learn quick steps to stop unwanted audio capture.
SessionReaper vulnerability hits Magento and Adobe Commerce stores, compromising 250+ sites in one day. Hackers steal data and hijack shopping sessions.
Master essential parental controls and digital safety tools to protect your kids online. Learn screen time limits, location settings and privacy controls every parent needs.
Cybersecurity expert shares six essential steps to protect against dark web threats, including data removal services, password managers and antivirus software.
NVIDIA GPU space mission could revolutionize cloud services by enabling orbital data centers that make apps, games and AI tools faster and more efficient.
Stay up to date on the latest AI technology advancements and learn about the challenges and opportunities AI presents now and for the future.
Microsoft warns Windows 10 users face serious security risks as 90% of ransomware attacks target unsupported systems. Learn why upgrading to Windows 11 is crucial.
Nike unveils Project Amplify, revolutionary motorized shoes developed with Dephy that add powered assistance to every step for runners and walkers.
Cybersecurity experts warn about one of the largest credential compilations ever found, urging users to check "Have I Been Pwned" and change passwords immediately.
Quick iPhone and Android battery optimization techniques help your device stay powered all day by turning off hidden features that secretly drain power in the background.
Kodiak Driver autonomous truck achieves perfect 98 safety score, matching top human fleets in groundbreaking AI evaluation by Nauto's VERA system.

Groupware: Answers the 5 Questions of Document Collaboration

Every organization which creates collaborative documents, whether they are budgets,... Read More

How to Build a Basic CSS Layout

Designing without tables by using CSS layouts is fast becoming... 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

Enterprise Resource Planning Overview

ERP (Enterprise Resource Planning) Overview covers What is ERP, Brief... Read More

Understanding XML Server

XML Server can be a Web Server that stores the... Read More

Five Tips For A Great Software Demo

Whether you need to close a sale, gather end-user feedback,... Read More

Snort for Network IDS

What is Snort?Snort is an open source network intrusion detection... Read More

Navision Sales Module & Reporting: Jet Reports, C/ODBC, XBRL, Business Analytics ? highlights

Microsoft bought Navision, Denmark based software development company, along with... Read More

Performance Tuning of a Daffodil DB / One$DB -JDBC Application

This article illustrates the best practices to improve the performance... Read More

Microsoft Great Plains - Microsoft RMS Integration ? overview

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

Microsoft Great Plains Implementation: Collection Management ? Overview For Consultant

Microsoft Business Solutions Great Plains is very good fit for... Read More

International Support - Microsoft Great Plains VAR/Partner Selection ? Overview for V.P. IT

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

Accessing XML Using Java Technologies

The most important benefit of XML is its simplicity. Though... Read More

Huddle Up; Groupware on Three

It could just be me, but my experiences with document... Read More

Microsoft CRM Implementation - US Market Lessons

Microsoft CRM is CRM answer from Microsoft Business Solutions. If... Read More

Protect Your Most Vital Business Asset with Security Software

Homeland security, airport security, Internet security ??" these days we???re... Read More

Microsoft Business Solutions VAR/Partner Selection ? Overview for IT Director/Manager/Controller

Microsoft Great Plains and Microsoft CRM become more and more... Read More

Integrating Microsoft Great Plains Accounting/ERP: RMS, CRM, eCommerce, Lotus Domino ? overview

Microsoft Business Solutions Great Plains has substantial market share among... Read More

Microsoft CRM Implementation ? Fundamental CRM Principles Revision

Microsoft CRM is relatively new player on the now becoming... Read More

You Can Write Microsoft Office Program in About 60 Minutes

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

Microsoft Great Plains: Offshore Customization & Development ? Overview for Consultant

When you visit department stores and see that majority of... Read More

Microsoft Great Plains Chemicals & Paint Industry Implementation & Customization Notes

Microsoft Great Plains fits to majority of industries, in the... Read More

Microsoft Great Plains in Metal Distribution: Implementation & Customization ? Consultant Overview

Microsoft Business Solutions Great Plains serves to the wide spectrum... Read More

Free Software for Newbies and Web Developers

Here is some free software tools to help you build... 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

spotless home service Arlington Heights ..