input using printf/scanf

I have a extreme hard problem on today's class.
Please help! I am not quite sure how to store the value in this case..
The topic is called "limited summation".

The following is the guideline for this problem:


Write a program in a folder called "sum" with a source file of main.cpp that does the following:
• prompt a user to enter a maximum number of entries, make the prompt "max # entries"
• prompt a user to enter a threshold sum, make the prompt "threshold"
• using error checking logic, let a user enter base-10 signed numbers until at least one of the following conditions is true:
o the maximum number of entries is reached
o the sum of entered numbers has reached (>=) the threshold
• print the sum of all the entries, just the number and a linefeed at the end of the line
Error checking means entries that are not numbers are detected and ignored. You are to use printf and scanf in this assignment (no cin or cout).

I cannot use cin/cout on this assignment!!
If you want to know how to use printf and scanf, follow these links:
printf: http://www.cplusplus.com/reference/cstdio/printf/
scanf: http://www.cplusplus.com/reference/cstdio/scanf/

There are relevant examples for each one at the bottom of the page. On another note, its ridiculous not to use std::cin or std::cout for a C++ program. Unless you are meant to be doing this in C.
Topic archived. No new replies allowed.