I had to take computer science for my major, but I have no idea what's going on in this class.

I have to write an algorithm that reads in ten positive integers from the keyboard (upper size limit is 99). Output the additive total of the ten numbers and also output the smallest of those ten numbers. Illegal inputs (<1 or >99) are to be discarded and a replacement entry accepted if legal.

can anybody PLEASE tell me what this means

You already just gave the "algorithm", so what do you need? Is it that you have no concept of how to write this in somesort of pseudo-code?

yeah I don't know how to start or how to even write this thing

A for loop will allow you to have a user enter the ten numbers

for(variable=1 to variable is less than or equal to 10, then increment the variable)
//In the body of the loop you will ask the users to enter the numbers

Did you have a specific programming language in mind?

i don't know how to start a loop or write an algorithm how do you write this?

i don't know how to start a loop or write an algorithm how do you write this?

If your not using a specific programming language and just want psuedocode, my previous post should be ok for you. Well the loop part at any rate.

it says using a PDL of your choice

it says using a PDL of your choice

And what is your choice? :)
My personal favorite language is C++.

for(int i=1; i<=10; i++)

Have you ever learned about something called an array?
That could be used to store the 10 values, but if you've never learned arrays then there is a less effiecient way to solve your problem.

I don't even know what a PDL is but we're suppose to write the algorithm i stated above and make a matching code using C++ so with both ways work?

PDL is program design language. It involves no actual coding just writing words that describe what you want a program to do. This is pretty much what you did in your first post. Theb you take the words and turn it into computer code. I take it this is where you are stuck.

You're going to have to choose a language and begin learning the basics of that language. Regardless of what language you choose, you will have to learn about loops such as for loops, while loops, do while loops, etc. And of course, if statements, if else statements, etc. Once you learn these constructs you won't have so much trouble with this problem.

A c++ program to solve your problem can be done very simply.
First declare an array of size 10

int a[10];

then use a for loop to obtain a number for each of the 10 positions of the array.

for(int i = 1; i<=10; i++)
    {
            cout<<"enter number "<< i<<endl;
            cin>>a[i];
    }

Finally add all of the elements in the array by using the plus operator.

int sum=a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9]+a[10];
     cout<<"sum = "<<sum;

This is an easy way to solve your problem.

But how does that help him learn anything. . ?

I just gave some parts to help the OP get started. He needs to figure out how to use if statements to check illegal inputs and how to find the smallest number in the array. At the very least I introduced topics such as arrays that the OP can do further research to learn more about. Sorry if the post was bad.

commented: Nevermind, it was a misunderstanding. +4

Grn Xtrm gave a very good start here and I think it is your time to do your part. I suggest you research and read more on your preferred programming language to use.

Good luck! :)

can you try this way
for the algorithm loop in 'C' Language.

for ( vaiable = initialization, variable< Max No. To Loop,variable increment) ;

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.