CPlusPlusPractice

Simple C++ programs

  1. Hello World Program: output Hello World to the console

  2. Variables: program using various variables in C++

  3. User Input: simple program getting user input

  4. Basic Geometric Formulas: prompts user for to input a length (in centimeters) specified as a floating point value. Program computes the area of a square, circle and the volume of a cube with the input and returns the answer in meters.

  5. Average: program that asks user for four numbers and prints out the average of those numbers

  6. TempConvert: program that converts Celsuius temperatures to Fahrenheit temperatures

  7. Change: program that asks user for a whole number of cents, from 0-99, and outputs how many of each type of coin would represent the amount with the fewest total number of coins

  8. minMax: program that asks the user how many integers they would like to enter. The program will prompt the user to enter that many integers. Program returns the largest and smallest of those numbers.

  9. fileAdder: program that asks user for a filename. Program then reads the name of the file and opens the file and reads the list of integers in the file (with one integer perline). Program will then add the integers together and create an output file called sum.txt where it writes the sum to the file.

  10. numGuess: a program that prompts the user for an integer that another player will try to guess.

  11. multiply: recursive function that takes two positive integers and returns the product of those two numbers together. The function finds the product by using addition.

  12. findMedian: function that takes two parameters (array of integers and an int for the size of the array). Function then returns the median of the array.