Skip to content

Hordunlarmy/Exercise_with_C

Repository files navigation

Exercise_with_C

Smashing them exercises with C language

C exercises </pict ure>

Saying Hello

Constraint

  • Keep the input, string concatenation, and output separate.

Challenges

  • Write a new version of the program without using any variables.
  • Write a version of the program that displays different greetings for different people.

Counting the Number of Characters

Constraints

  • Be sure the output contains the original string.
  • Use a single output statement to construct the output.
  • Use a built-in function of the programming language to determine the length of the string.

Challenges

  • If the user enters nothing, state that the user must enter something into the program.
  • Implement this program using a graphical userinterface and update the character counter every time a key is pressed. If your language doesn’t have a particularly friendly GUI library, try doing this exercise with HTML and JavaScript instead.

Printing Quotes

Constraints

  • Use a single output statement to produce this output, using appropriate string-escaping techniques for quotes.
  • If your language supports string interpolation or string substitution, don’t use it for this exercise. Use string concatenation instead

Challenge

  • Modify this program so that instead of prompting for quotes from the user, you create a structure that holds quotes and their associated attributions and then display all of the quotes

Mad Labs

Constraints

  • Use a single output statement for this program.
  • If your language supports string interpolation or string substitution, use it to build up the output.

Challenges

  • Add more inputs to the program to expand the story.
  • Implement a branching story, where the answers to questions determine how the story is constructed.

Simple Math

Constraints

  • Values coming from users will be strings. Ensure that you convert these values to numbers before doing the math.
  • Keep the inputs and outputs separate from the numerical conversions and other processing.
  • Generate a single output statement with line breaks in the appropriate spots.

Challenges

  • Revise the program to ensure that inputs are entered as numeric values. Don’t allow the user to proceed if the value entered is not numeric.
  • Don’t allow the user to enter a negative number.
  • Break the program into functions that do the computations.
  • Implement this program as a GUI program that automatically updates the values when any value changes.

Retirement Calculator

Constraints

  • Again, be sure to convert the input to numerical data before doing any math.
  • Don’t hard-code the current year into your program. Get it from the system time via your programming language.

Challenge

  • Handle situations where the program returns a negative number by stating that the user can already retire.

About

smashing a set of exercises with C language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages