I am taking an intro to cs class. I have written a simple program but dont know if it is correct. please help me. thank you!

Where is your program by the way...???

I didnt think I could post it publically according to the rules. Here it is... please dont laugh.

/* sum of 10 numbers */  //   This program computes the value of the sum of 10 numbers 
#include <iostream.h> 

int main ( ) 
{
   //   Define and initialize variables
   float number, total, value of smallest variable;
   int i = 1;

   //   Read in 10 numbers from the keyboard
   while (i <= 10) {
        if (number >1 and <99);
        then (cin >> number);             // read number
    if ! (replace number)             // read number
    end if.
    total = total + number;    // total + number
        i = i + 1;                 // i++ 
};

   //   Compute sum and print result;
   Print smallest value;

   //   Exit program.
   return EXIT_SUCCESS;
}

Daniweb suggests you not to give away the codes directly to those who ask for it.
Here you have a doubt about your work and you are free to post the part in which you have a doubt in and ask queries related to it. As long as you put in your effort you will always get help from this community.And ya read about code tags.

You have put in a good effort but this is not a C++ program.As a matter of fact even your simple algorithm is incorrect. Here are the problems :

/* sum of 10 numbers */ 
// This program computes the value of the sum of 10 numbers
#include <iostream.h>
int main ( )
{
// Define and initialize variables
float number, total, value of smallest variable;
int i = 1;
// Read in 10 numbers from the keyboard
while (i <= 10) {
if (number >1 and <99);
then (cin >> number); // read number
if ! (replace number) // read number
end if.
total = total + number; // total + number
i = i + 1; // i++
};
// Compute sum and print result;
Print smallest value;
// Exit program.
return EXIT_SUCCESS;
}

Line 7 : "value of smallest variable" is not a variable at all because variables can only contain alphabets and '_' and numbers(not in the beginning).
Line 11:You haven even read the value of "number" and before that only you are checking it,the keyword "and" is used in program as "&&",you don't have a semicolon after the if condition(atleast not here in this problem).
Line 12 :No keyword then recognised.
.
.
and so on ....

I sincerely applaud your effort and zeal in writing the program but you need to learn a lot. so TRY THESE.

I thought reading the number is what I was doing in line 12.

I thought reading the number is what I was doing in line 12.

Yes you are reading the number in line twelve then what sense does it make to compare the number to be within some limits in line 11 itself....???

Yeah well, some of your "code" wasn't code at all, in fact, it was pseudo-code.
There is no such thing as "then" in C++. You evidently havn't learned C++, you've just seen pieces of code from places.

I am trying to learn... The instructor told us to use
If (condition)
Then (condition)
Else (condition) optional
end if.

I am trying to learn... The instructor told us to use
If (condition)
Then (condition)
Else (condition) optional
end if.

Its something called pseudocode which tells you how to code ... but you need to code it according to language rules... that you haven done....

Is there a website I can go to or something? I am using my intro to C++ book and notes from class, but it all seems so foreign to me. I cant seem to make heads or tails of what I am suppose to do.

Is there a website I can go to or something? I am using my intro to C++ book and notes from class, but it all seems so foreign to me. I cant seem to make heads or tails of what I am suppose to do.

GOOGLE is your friend... try asking it and also this website is good ... And you are presently in a place where you can learn anything... DANIWEB.

I dont know if I know the right questions to ask to get the answers I need. I will keep trying though. Thank you for your help

Is there a website I can go to or something? I am using my intro to C++ book and notes from class, but it all seems so foreign to me. I cant seem to make heads or tails of what I am suppose to do.

If that is really true, then you have 2 options ahead of you.
#1:Either drop C++ and go become a doc.
#2: Or wait a bit until the lust for it develops in you.

Here's some sites you might find useful:
www.learncpp.com
www.cplusplus.com

and the almighty:
www.google.com

Oh yeah, most good students are self motivated to the subject they learn. They don't sleep in classes and don't simply stare at the pages instead of trying to make sense out of them.

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.