Urgent!!C++ task solution needed.

Task 2

Develop a C++ application which will perform the following tasks:

• prompt the user to input a list of positive integer numbers. The total numbers in the list should be chosen by the user.
Numbers equal to zero are allowed in the list. If the user input a negative number, the program should ask the user to input a new number.
• calculate how many even numbers, odd numbers and numbers equal to zero are in the list.
• print on the screen the results of the calculations.

In developing the application use the steps of a problem solving in order to help you with developing the algorithm. Write in a document file the algorithm as a flow chart or pseudocode (or both) and test it before you start the C++ implementation.
Implement the algorithm as a C++ program and test it using the necessary number of test cases.
Write the test cases, the output of the C++ program and the comparison of the program output with the expected output in a document file.
At least attempt it raheel92 and show us how far you've gotten with it and which parts exactly that you need help with. Otherwise you're not learning anything, it's just people coding for you.
Can you help in finding max and min numbers using C++
#include<iostream>
using namespace std;

int main()
{
int i=0,max=100000,min=0,x;
cout<<"Please input 10 numbers"<<endl;
do
{
cin>>x;
}
while(i++,i<3);
if(x<max && x>min)
{
cout<<"Maximum number is"<<x<<endl;
}
else if(x>max || x<min)
{
cout<<"Minimum number is"<<x<<endl;
}







system("PAUSE");
return 0;
}
Is this correct,can you please check?
the 3 needs to be replaced with 10.
while(i++,i<3);

This is completely wrong. There should be no semi-colon there, and I doubt very much that you know enough about this to be able to handle a comma in the middle of a while condition.

Why is there even an i in there? You don't even use i. It looks like some kind of mutant for loop.
Last edited on
Moschops thats a do-while loop and Visual Studio 2010 Express suggested to put a comma afterwards.
i is a counter just a variable.:/
ok please can you help me in modifying the snippets,which you believe are wrong.
I have made a successful C++ application,finally.Thanks for not cooperating :/ You could have at least showed an example.

Anyway,
#include<iostream>
using namespace std;

int main()
{
int i=1,min=100000,max=0,x;
cout<<"Please input 10 numbers"<<endl;
do
{
cout<<"Enter the numbers"<<i++<<"of your 10 numbers"<<endl;
cin>>x;
if(x<min)
{
min=x;
}
else if(x>max)
{
max=x;
}
}
while(i<11);
cout<<"The smallest number is"<<min<<endl;
cout<<"the largest number is"<<max<<endl;



system("PAUSE");
return 0;
}
closed account (zvRX92yv)
A - Use [code][/code] tags

B - Clean up your code, it's hard to read - www.cplusplus.com/articles/Gy86b7Xj/

C - Don't use system() calls - www.cplusplus.com/articles/j3wTURfi/

D - Read the tutorial on this website, come back here if you have any questions! And try to understand all the examples, until you do, don't move forward to the next chapter.
Last edited on
Moschops thats a do-while loop and Visual Studio 2010 Express suggested to put a comma afterwards.


Oh, whups. So it is. My fault for scanning it improperly. I apologise.

I maintain that having a comma in there is a bad idea. It's not wrong, but it's beyond your ability, and doing it just because a machine told you do is never a smart move. I see you've taken it out now. Good idea.
Thanks for not cooperating :/ You could have at least showed an example.


That is rude and ridiculous! Expecting people on the internet to provide you with free help in less than 20 minutes is not very realistic.
raheel92 wrote:
Thanks for not cooperating :/ You could have at least showed an example.


LOL! Some nerve on this guy. Let me introduce you to a very dear friend of mine: Please meet Google (www.google.com). You can ask him ANYTHING. I swear! Even C++ examples. No! I'm NOT kidding. It's true! You should try it some time.
Topic archived. No new replies allowed.