C++ Language Basics Console

C++ examples for Language Basics:Console


Click the following links for the tutorial for Language Basics and Console.

  1. Requests a name, prints the name five times, and rings a bell.
  2. Display a string on-screen.
  3. Compute sales tax and display it with an appropriate message.
  4. Ring the bell on your computer by assigning the \a escape sequence to a variable, then printing that variable.
  5. Terminate char array with \0 and output with cout
  6. Asks the user for a first and last name. Use the cin operator to retrieve data from the keyboard.
  7. Use cin to read int value
  8. Use cin to read char array as string

  9. Get to know the cin Operator, read float value
  10. Prints values in variables with appropriate labels. A few messages included and some newline characters placed where needed:
  11. To print a table of numbers, you can use the \t tab character to do so.
  12. Illustrates various integer width cout modifiers, setw
  13. Prints a table of team names and hits using width-modifying conversion characters.
  14. Computes and prints payroll data properly in dollars and cents, setprecision and setw
  15. Uses the shortcut floating-point width method.
  16. Print the square of the input value if the input value is less than 180.

  17. Asks the user for a number, prints whether or not the number is greater than zero, using the if-else statement.
  18. Tests the user's first initial and prints a message.
  19. Ensure user types a correct response.
  20. Output message to console window
  21. Calculate value in the output statement
  22. Reads in the radius of a circle as an integer and prints the circle's diameter, circumference and area.
  23. Read three integers, prints the sum, average, product, smallest and largest of these numbers. Use macros
  24. Read two integers from user, prints the larger number followed by the words 'is larger', use macro
  25. Prints the numbers 1 to 4 on the same line with each pair of adjacent numbers separated by one space.
  26. Displaying Shapes with As asterisks
  27. Display the following pattern with eight output statements.
  28. Calculates the squares and cubes of the integers from 0 to 10. Use tabs to print the formatted table of values.
  29. Read a five-digit integer, separates the integer into its digits and prints them separated by three spaces each.
  30. Create Tabular Output
  31. Print Letter Pyramid
  32. Prompt user to enter an integer to control the program's output.
  33. Demonstrates cin, newline
  34. Demonstrate need for setw manipulator
  35. Generates table with cout and setw
  36. Displays multiples of a number
  37. What is the output from the program? cout statement
  38. Commonly Used Stream Manipulators
  39. Format Flags for Use with setiosflags()
  40. Int literal in octal and hexadecimal
  41. Oct and hex manipulators are used for conversions to octal and hexadecimal
  42. Formatting Numbers for Program Output
  43. Calculate the time it takes a ball to hit the ground after it has been dropped from an 800-foot tower.
  44. Calculate inside cout statement
  45. Read more than one value in cin statement
  46. Control the field width with setw to leave gap between two values
  47. Data is accepted continuously until a number larger than 100 is entered.
  48. Read user input and store it into an array
  49. Formatting data via printf()