Movatterモバイル変換


[0]ホーム

URL:


Menu
×
See More 
Sign In
+1 Get Certified Upgrade Teachers Spaces Get Certified Upgrade Teachers Spaces
   ❮     
     ❯   

C++ Tutorial

C++ HOMEC++ IntroC++ Get StartedC++ SyntaxC++ OutputC++ CommentsC++ VariablesC++ User InputC++ Data TypesC++ OperatorsC++ StringsC++ MathC++ BooleansC++ If...ElseC++ SwitchC++ While LoopC++ For LoopC++ Break/ContinueC++ ArraysC++ StructuresC++ EnumsC++ ReferencesC++ PointersC++ MemoryManagement

C++ Functions

C++ FunctionsC++ Function ParametersC++ Function OverloadingC++ ScopeC++ RecursionC++ Lambda

C++ Classes

C++ OOPC++ Classes/ObjectsC++ Class MethodsC++ ConstructorsC++ Access SpecifiersC++ EncapsulationC++ Friend FunctionsC++ InheritanceC++ PolymorphismC++ TemplatesC++ FilesC++ Date

C++ Errors

C++ ErrorsC++ DebuggingC++ ExceptionsC++ Input Validation

C++ DataStructures

C++ Data Structures & STLC++ VectorsC++ ListC++ StacksC++ QueuesC++ DequeC++ SetsC++ MapsC++ IteratorsC++ Algorithms

C++ Namespaces

C++ Namespaces

C++ Projects

C++ Projects

C++ How To

C++ Add Two NumbersC++ Random Numbers

C++ Reference

C++ ReferenceC++ KeywordsC++ <iostream>C++ <fstream>C++ <cmath>C++ <string>C++ <cstring>C++ <ctime>C++ <vector>C++ <algorithm>

C++ Examples

C++ ExamplesC++ Real-Life ExamplesC++ CompilerC++ ExercisesC++ QuizC++ SyllabusC++ Study PlanC++ Certificate


C++Keywords


C++ Keywords

A list of useful keywords in C++ can be found in the table below.

KeywordDescription
andAn alternative way to write the logical&& operator
and_eqAn alternative way to write the&= assignment operator
autoAutomatically detects the type of a variable based on the value you assign to it
bitandAn alternative way to write the& bitwise operator
bitorAn alternative way to write the| bitwise operator
boolA data type that can only store true or false values
breakBreaks out of a loop or a switch block
caseMarks a block of code in switch statements
catchCatches exceptions generated by try statements
charA data type that can store a single character
classDefines a class
complAn alternative way to write the~ bitwise operator
constDefines a variable or parameter as a constant (unchangeable) or specifies that a class method does not modify attributes of the class
continueContinues to the next iteration of a loop
defaultSpecifies the default block of code in a switch statement
deleteFrees dynamic memory
doUsed together with while to create a do/while loop
doubleA data type that is usually 64 bits long which can store fractional numbers
elseUsed in conditional statements
enumDeclares an enumerated type
falseA boolean value equivalent to 0
floatA data type that is usually 32 bits long which can store fractional numbers
forCreates a for loop
friendSpecifies classes and functions which have access to private and protected members
gotoJumps to a line of code specified by a label
ifMakes a conditional statement
intA data type that is usually 32 bits long which can store whole numbers
longEnsures that an integer is at least 32 bits long (uselong long to ensure 64 bits)
namespaceDeclares a namespace
newReserves dynamic memory
notAn alternative way to write the logical! operator
not_eqAn alternative way to write the!= comparison operator
orAn alternative way to write the logical|| operator
or_eqAn alternative way to write the|= assignment operator
privateAn access modifier which makes a member only accessible within the declared class
protectedAn access modifier which makes a member only accessible within the declared class and its children
publicAn access modifier which makes a member accessible from anywhere
returnUsed to return a value from a function
shortReduces the size of an integer to 16 bits
signedSpecifies that anint orchar can represent positive and negative values (this is the default so the keyword is not usually necessary)
sizeofAn operator that returns the amount of memory occupied by a variable or data type
static Specifies that an attribute or method belongs to the class itself instead of instances of the class
Specifies that a variable in a function keeps its value after the function ends
struct Defines a structure
switch Selects one of many code blocks to be executed
template Declares a template class or template function
this A variable that is available inside class methods and constructors which contians a pointer to a class instance
throw Creates a custom error which can be caught by a try...catch statement
trueA boolean value equivalent to 1
tryCreates a try...catch statement
typedefDefines a custom data type
unsignedSpecifies that anint orchar should only represent positive values which allows for storing numbers up to twice as large
using Allows variables and functions from a namespace to be used without the namespace's prefix
virtual Specifies that a class method is virtual
void Indicates a function that does not return a value or specifies a pointer to a data with an unspecified type
while Creates a while loop
xorAn alternative way to write the^ bitwise operator
xor_eqAn alternative way to write the^= assignment operator


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning.
Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness
of all content. While using W3Schools, you agree to have read and accepted ourterms of use,cookies andprivacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved.W3Schools is Powered by W3.CSS.


[8]ページ先頭

©2009-2025 Movatter.jp