HTW Berlin
Fachbereich 4
Internationaler Studiengang
Internationale Medieninformatik (Bachelor)
Info 2: Informatik II
Winter Term 2010/11
Exercise 13: Getting your feet wet with C++
In class:
Let's get cracking on C++. Your first order of business is to figure out how to compile a file for C++. Choose Eclipse or Visual Studio or Seat of Your Pants (aka using gcc from the command line). Do a "Hello World" program and document what exactly you had to do to get it to work.
Write a small main file in C++ that reads in numbers from cin. As long as the numbers are positive, keep reading. When you get a negative number, stop reading and print the average, the maximum and the minimum to cout.
Remember how to check if a number is prime? Write a small program in C++ to print out the first 1000 prime numbers (not the prime numbers less than 1000!).
Write a program that reads in numbers from cin. As long as the number is positive, calculate its representation in Roman numerals and output this to cout. Stop when you read a non-positive number. Note that you will never have more than 3 characters repeated, 9 is not "VIIII", but "IX". The bored can read in a string representing a Roman numeral and calculate its value.
(For the bored) Write a program that takes values between 0 and 110 and calculates the German grade according to the grade table. Stop on entry of a negative value, print an error message if a larger number or a non-number is entered. Only use named constants for all values except 0 and 1!
Letzte Änderung:
2010-01-09 19:19
[an error occurred while processing this directive]