1. ## translate

I dont get this question can anyone make it much more easier to understand cause i dont understand the question you don't need to answer the question just explain what am i going to do tnx^_^..

Write a program that computes the following sum:
sum = 1.0/1 + 1.0/2 + 1.0/3 + 1.0/4 + 1.0/5 + .... + 1.0/N
N will be an integer limit that the user enters.
Enter N
4

Sum is: 2.08333333333

I can't understand the question.......???help needed

2. sum = 1.0/1 + 1.0/2 + 1.0/3 + 1.0/4 + 1.0/5 + .... + 1.0/N
Use a for loop on the red bits.

3. like this??
Code:
for(int a=1; a<=N; a++){
formula..........
}

4. Originally Posted by limitmaster
like this??
Code:
for(int a=1; a<=N; a++){
formula..........
}

5. okey tnx...^_^
Code:
#include <iostream>

main(void)
{

int n, sum =1;
std::cout << "input number\n";
std::cin>> n;
std::cin.ignore();
for(int a=1; a<=n; a++){
sum += 1.0/a;
}
std::cout << sum;
std::cin.get();
}

6. I got another problem and again can someone make it clearer to me as much as possible tnx..
here's the question;

Write a program that computes the standard deviation of a set of floating point numbers that the user enters. First the user will say how many numbers N are to follow. Then the program will ask for and read in each floating point number. Finally it will write out the standard deviation. The standard deviation of a set of numbers Xi is:
SD = Math.sqrt( avgSquare - avg2 )
Here, avg is the average of the N numbers, and avg2 is its square.
avgSquare is the average of Xi * Xi. In other words, this is the average of the squared value of each floating point number.
For example, if N = 4, say the numbers were:
Xi Xi * Xi
2.0 4.0
3.0 9.0
1.0 1.0
2.0 4.0
----- ------
sum 8.0 18.0
then
avg = 8.0/4 = 2.0
avg2 = 4.0

avgSquare = 18.0/4 = 4.5

SD = Math.sqrt( 4.5 - 4.0 ) = Math.sqrt( .5 ) = 0.7071067812
To do this you will need to do several things inside the loop body for each floating point value as it comes in: add it to a sum, square it and add it to a sum of squares. Then after the loop is finished apply the formula.

Im poor in analysis and that is a very big problem in me

__________________________________________________ ______________________________________

nvm the question above^_^. i think i got it......but i have a question..........
the user must determine how many numbers he/she gonna input for ex. the user want's to input 5 or 3 or 6 numbers... i can't use if else statement i can't say
Code:
if(num==5){ for(int a=1; a<=5; a++) cout << "input number"; }or if(num==3)etc..
.......i don't know what to use....anyone there that can help me out tnx...

7. > First the user will say how many numbers N are to follow.

You've described in a very detailed manner what you want to do, so now just go and do it.

Print out your description on paper and read it one sentence or paragraph at a time.
Copy that statement as a comment in the code, then write and test the code (should be just a few lines in most cases).
When it's done, cross that description out on your paper and move onto the next one.

Eg.
The words say
"First the user will say how many numbers N are to follow."

The code looks like
Code:
// First the user will say how many numbers N are to follow.
int N;
cout << "How many?";
cin >> N;
See how you get on with that and post where you get to.

8. Yes thank you^_^ i got it...
Code:
#include <iostream>
#include <math.h>
using namespace std;

int main()
{
float num;
int avg = 0, avg2, n;
cout << "How many numbers would u like to input^_^\n";
cin >> n;
for(int a =1; a<=n; a++){
cout << "input number\n";
cin >> num;
cin.ignore();
avg += num;
}.............
i'll just finish the code^_^tnx....

9. tnx for the help i completed my exercise^_^. I'll start my next one later....tnx again.
Code:
#include <iostream>
#include <math.h>
using namespace std;

int main(void)
{
float num, avg = 0, avgsqr = 0, tl1, tl2, SD;
int n;
cout << "How many numbers would u like to input^_^\n";
cin >> n;
for(int a =1; a<=n; a++){
cout << "input number\n";
cin >> num;
cin.ignore();
avg += num;
num *= num;
avgsqr += num;
tl1 = avg/n;
tl2 = avgsqr/n;
SD = tl2 - tl1;
}
cout <<"avg = " << avg << "= " << tl1 << "\n";
cout << "avg2 = " << sqrt(tl1) << "\n";
cout << "avgSquare = " << avgsqr << "\n";
cout << "avgSquare/" << n << " = " << tl2 << "\n";
cout << "SD = " << sqrt(SD) << "\n";
cin.get();
}

10. Looking pretty good.