1) Explain datatypes in c++. 2) Explain declaration & branching control statement in c++. 3) Explain object oriented methodology in c++.

1 Answer | Add Yours

crmhaske's profile pic

crmhaske | College Teacher | (Level 3) Associate Educator

Posted on

1) A datatype in any programming language defines the type of data a variable will hold in memory.  The basic datatypes in C++ are:

char --> character (such as "a" or b"), or a small integer (-128<n<127 or 0<n<255)
int --> integer (whole numbers)
bool --> boolean (i.e. true or false)
float --> floating point number (can have decimal numbers up to 7 digits)
double --> double precision floating point number (can have decimal numbers up to 15 digits)

2) Control statements in programming control what pieces of code will be executed when.

Branching control statement --> depending on the condition, different code will be executed.  Examples of branching control statements are if and switch statements

Declaration control statement --> executes code while the conditions of the statement are being met, these are typically loops: for, while etc.

3) Object oriented program essentially models computer language as easy to decipher thinking.  Unlike machine code which is like learning a new language entirely, in object oriented programming it reads and flows like thought: if this, then do that, for this, do that, etc.

We’ve answered 317,505 questions. We can answer yours, too.

Ask a question