Save
Busy. Please wait.
Log in using Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password

why


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't know
Remaining cards (0)
Know
0:00
share
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

C++ Coding Basics

C++ is a compiled language and includes OO features. "Quiz 4"

QuestionAnswer
What function must every program have in C++? int main() {...}
How do you denote a comment in C++? Also multi-line comments? // A Comment: also an OS-independent newline. /* ... */ Denotes a multi-line comment.
How should you create C++ source code files? With what extension does the file have? C++ source code files should be created with a text editor and have the extension .cpp
In Windows, the GNU C++ compiler is called DJGPP; How do you compile and run the source code titled hello.cpp from an MS-DOS box? gxx hello.cpp -o hello.exe >>>hello
How do you compile and run hello.cpp in the UNIX shell window? g++ hello.cpp -o hello -Wall -O ./hello
What function does -o hello serve? -o renames the default a.out executable. In Windows the default is A.EXE
What function does -Wall serve? -Wall turns on all warnings.
What function does -O serve? -O optimizes (compiles slower but runs faster)
How do you use the network or GUI interface in UNIX? You must use the X and socket libraries.
How do you use the network or GUI interface in Windows? You must use the Windows API and a compiler that supports them; such as, from Microsoft. GUI/network programming is nonportable.
Where can you find links to free and commercial C++ compilers? Visit cplusplus (dot) com for links.
A program is a collection of what three elements? A program is a collection of functions, and type and object declarations.
s; Expression or declaration
; Empty statement
{s; s;} A block or 0 or more statements is a statement
if (t) s; If t is true then s
if (t) s; else s; else is optional
while (t) s; Loop 0 or more times
for (s1; t; s2) s; s1; while (t) (s; s2;)
break; Jump from while, for, do, switch
return x; Return x to calling function
try {throw x;} Throw exception, abort if not caught, x has any type
catch (T y) {s;} catch (...) {s;} if x has type T then y=x, jump to s else jump here (optional)
do s; while (t); (uncommon) s; while (t) s;
continue; (uncommon) Start next loop of while, for, do
switch (i) { case C: s; break; default: s; } if (i==C) go here optional, else go here
label: goto label; (rare) Jump to label within a function
Give a declaration example: int a[10], i=0, j;
Give a expression example: a[i+2]=3;
Declarations are destroyed at the end of a block {s; s;} (True/False)? Declarations like a, i, j; and expressions like a[i+2]=3 are destroyed at end of block {s; s;}.
18 levels of operator precedence: 1 X::m Member m of namespace or class X ::m Global name m when otherwise hidden by a local declaration
18 levels of operator precedence: 2 p[i] i'th element of container p x.m Member m of object x p->m Member m of object pointed to by p f(x,y) Call function f() i++ i-- static_cast<T>(x)
18 levels of operator precedence: 3 *p &x -a !i (T)x new T delete p ++i --i sizeof x
18 levels of operator precedence: 4 x.*p (rare) q->*p (rare)
18 levels of operator precedence: 5 a*b a/b i%p
18 levels of operator precedence: 6 a+b a-b
18 levels of operator precedence: 7 x<<y x>>y
18 levels of operator precedence: 8 x<y x>y x<=y x>=y
18 levels of operator precedence: 9 x==y x!=y
18 levels of operator precedence: 10 i&j AND
18 levels of operator precedence: 11 i^j XOR
18 levels of operator precedence: 12 x|j OR
18 levels of operator precedence: 13 i&&j i AND THEN j only if i is TRUE
18 levels of operator precedence: 14 i||j i OR ELSE j only if i is FALSE
18 levels of operator precedence: 15 x=y x+=y
18 levels of operator precedence: 16 i?x:y If i is TRUE then x ELSE y
18 levels of operator precedence: 17 throw x
18 levels of operator precedence: 18 x,y Evaluate x and y, RESULT is y
Created by: themagicdwarf
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!

"Know" box contains:
Time elapsed:
Retries:
restart all cards