1-Write a program that prompts the user to input two positive integers (firstNum and secon
Num) where the first number should be less than the second (validate your input). The program
should output all the numbers and their squares between firstNum and secondNum (inclusive).

2-Write a C++ program which reads a collection of exam scores. Your program should count
and display the number of outstanding scores (between 90-100), the number of satisfactory
scores (between 60-89), and the number of unsatisfactory scores (between 0-59). The input
process should stop when the user enters an exam score with the value -1.

how to solve those :"(!

Recommended Answers

All 6 Replies

Start at the beginning.

Write a program that prompts the user to input two positive integers

Can you do this?

yes i can .. then ?

the first number should be less than the second (validate your input).

Can you do that?

ok, i took two inputs from the user but how can i validate it ?

In this context, it means that you must check that the first number is less than the second, and if it is not, have the user enter them again. The logic is as follows:

LOOP:
get both inputs
if first input is less than second, end loop

So you will need to know how to make a loop, and how to compare two values, and make a decision based on that comparison.

Loops: http://www.cplusplus.com/doc/tutorial/control/

Those examples also contain comparisons you can adapt to your needs.

Ms.toumi, thsi forum is not designed for people to do your work for you. If you need help, then show us something you have already done, little bits of code that you have started to develop towards your solution.

Do not just ask for help and give a description of your problem. You cannot learn without trying and failing to do things.

There are so many people who are willing to help, but you need to make some effort yourself.

Show us what you have and we will help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.