C ++ Enrichment
1. Variables- Have to be defined before you use it so the computer can recognize it.
2. Printf Function
3. Scanf Function
4. If/else
-
They are the backbone of programming and make everything else possible. They are used for making decisions.
-
They say if something, do this. If else do this. And let you react to different situations.
-
Ex)
if
{
printf("correct! Your current score is %i!\n",score);
}
( guess == r )else
{
printf("wrong, your current score is %i.\n",score);
}
{
printf("too low\n");
}
{
printf("too high\n");
}
- Enclosed in curly brackets and use printf functions. Use the words if and else.
if( guess < r)if( guess > r)
Loops (ex. while and for):
-
Codes used to make a certain action repeat again and again.
-
If you were creating a game, you could use a loop to allow the user to play the game continuously until they win.
Arrays:
Functions:
Comments (0)
You don't have permission to comment on this page.