Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

lindag1783

@lindag1783
About
Posts
10
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • how to square a value
    L lindag1783

    Hi everyone thanks a bunch for all your help here. :-) I did want the value to be squared, not power to, it is the opposite of what pow does (if pow is to the power of - seeing it starts with Pow for Power). I was after the square - you know the square button on your calculator. So the square root. Thanks:laugh: linda

    C / C++ / MFC question c++ help tutorial

  • how to square a value
    L lindag1783

    Hi I am wondering how you can square a value in C++. I want to work out the square of a number that the user inputs but I dont know how you would type in the command so that the computer will square this number. What is the command for squared? Please help. Thank You. linda

    C / C++ / MFC question c++ help tutorial

  • trouble with calculations
    L lindag1783

    Just one more question. This 0.0 declaration works well now it will work out the variance but only if all scores are input, what if you only have 2 scores, how do you leave the other fields blank. Thanks linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi Thanks so much for all this help, it is much appreciated. This is my first program, good guess! I would like to eventually work out some more things but I think I must hit the books about it before that will happen, very much lacking in knowledge. Thank you all for all your help regarding this problem. :-> linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi Thanks for your help. How do I initilize these variables, I am very new to this. So, this will only work for certain scores? Like, if I input a score that is higher then the mean then the variance will not work? (is that what you meant at the end?). How would I get it to work for all scores then, is there any special way or code I can use to fix this? Thanks once again. Much appreciated.:-D linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi there Thanks for that I appreciate your code, it is good. I think I need to study some more before attempting to write calculations like this:rolleyes: :-) linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi, I really appreciate your help here. The variance is worked out like the first example that you redirected my browser to regarding variance (the website about it). Example: Numberofscores(N)=2, score1=2, score2=5, all the other scores are input as 0 (seeing there is no scores). The mean is worked out as 2 + 5 / 2 = 3.5 (the program will do this calculation). Variance is worked out like this: (score1 - Mean) to the power of 2 + (score2 - Mean) to the power of 2 / 2 (N). I did not know what power was in C++ so I times it by itself. I think maybe there is something wrong with the compiler I am using as it will not recognise some commands. It does not return any errors but the calculations are wrong for the variance. Here is my code: #include using namespace std; int main(void) { double M, N, total, score1, score2, score3, score4, score5, score6, score7, score8, V1, V2, V3, V4, V5, V6, V7, V8, s1, s2, s3, s4, s5, s6, s7, s8; cout << "Input the number of people in sample "; cin >> N; cout << "input the 1st score "; cin >> score1; cout << "input the 2nd score "; cin >> score2; cout << "input the 3rd score "; cin >> score3; cout << "input the 4th score "; cin >> score4; cout << "input the 5th score "; cin >> score5; cout << "input the 6th score "; cin >> score6; cout << "input the 7th score "; cin >> score7; cout << "input the 8th score "; cin >> score8; total = score1 + score2 + score3 + score4 + score5 + score6 + score7 + score8; M = total / N; cout << "the mean for these scores is: " << M << "\n"; s1 = score1 - M; V1 = s1 * s1; s2 = score2 - M; V2 = s2 * s2; s3 = score3 - M; V3 = s3 * s3; s4 = score4 - M; V4 = s4 * s4; s5 = score5 - M; V5 = s5 * s5; s6 = score6 - M; V6 = s6 * s6; s7 = score7 - M; V7 = s7 * s7; s8 = score8 - M; V8 = s8 * s8; cout << "the variance for these scores is: " << (double) (V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8) / N << "\n"; return 0; } linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi Thanks for your reply. I have insert double instead of float but I still get the same mistakes. he mistakes sometimes are way off from the true answer, so onlsy sometimes are they close to the answer. In this case the answer came back way off again, by about 40! Anyway, I am sure my logic is correct so it mst be the code somehow. Please help. Here is my code: #include using namespace std; int main(void) { double M, N, total, score1, score2, score3, score4, score5, score6, score7, score8, V1, V2, V3, V4, V5, V6, V7, V8, s1, s2, s3, s4, s5, s6, s7, s8, Variance; cout << "Input the number of people in sample "; cin >> N; cout << "input the 1st score "; cin >> score1; cout << "input the 2nd score "; cin >> score2; cout << "input the 3rd score "; cin >> score3; cout << "input the 4th score "; cin >> score4; cout << "input the 5th score "; cin >> score5; cout << "input the 6th score "; cin >> score6; cout << "input the 7th score "; cin >> score7; cout << "input the 8th score "; cin >> score8; total = score1 + score2 + score3 + score4 + score5 + score6 + score7 + score8; M = total / N; cout << "the mean for these scores is: " << M << "\n"; s1 = score1 - M; V1 = s1 * s1; s2 = score2 - M; V2 = s2 * s2; s3 = score3 - M; V3 = s3 * s3; s4 = score4 - M; V4 = s4 * s4; s5 = score5 - M; V5 = s5 * s5; s6 = score6 - M; V6 = s6 * s6; s7 = score7 - M; V7 = s7 * s7; s8 = score8 - M; V8 = s8 * s8; cout << "the variance for these scores is: " << (double) (V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8) / N << "\n"; return 0; } :confused: linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hi thanks, what i mean by quet is that sometimes it will give the answerr that is close to the answer and tother times the answer is way off. I do not know what to do. I want to calculate the variance of a single sample thus it is /N, /N-1 is only used in test that have two sets of samples. Thanks linda

    C / C++ / MFC c++ help tutorial

  • trouble with calculations
    L lindag1783

    Hello I have writen this in C++ (using the compiler Visual C++ 2005 Express Edition). I am now having some trouble with calculations. I want to work out each sample scores variance (which is used in statistics). I have a bunch of scores that hte user inputs and I can work out the average, that is the program will do that part, but when it comes to working variance the answers are wrong. The variance is worked out like this - each score minus the mean, to the power of two (or times by itself), all these scores then have to be divided by the Number of scores that are in the sample. The program cannot calculate this. For example, there are 2 scores, 1st score = 5, 2nd score = 4; it works out the mean (average) okay which is the total of all the scores divided by the number of scores in the sample. It gets very close to figuring the right amount for the variance, but not quiet. Please help me figure out where I've gone wrong. Thank You in advance. Here is my code: #include using namespace std; int main(void) { float M, N, total, score1, score2, score3, score4, score5, score6, score7, score8, V1, V2, V3, V4, V5, V6, V7, V8, s1, s2, s3, s4, s5, s6, s7, s8, Variance; cout << "Input the number of people in sample "; cin >> N; cout << "input the 1st score "; cin >> score1; cout << "input the 2nd score "; cin >> score2; cout << "input the 3rd score "; cin >> score3; cout << "input the 4th score "; cin >> score4; cout << "input the 5th score "; cin >> score5; cout << "input the 6th score "; cin >> score6; cout << "input the 7th score "; cin >> score7; cout << "input the 8th score "; cin >> score8; total = score1 + score2 + score3 + score4 + score5 + score6 + score7 + score8; M = total / N; cout << "the mean for these scores is: " << M << "\n"; s1 = (float) score1 - M; V1 = (float) s1 * s1; s2 = (float) score2 - M; V2 = (float) s2 * s2; s3 = (float) score3 - M; V3 = (float) s3 * s3; s4 = (float) score4 - M; V4 = (float) s4 * s4; s5 = (float) score5 - M; V5 = (float) s5 * s5; s6 = (float) score6 - M; V6 = (float) s6 * s6; s7 = (float) score7 - M; V7 = (float) s7 * s7; s8 = (float) score8 - M; V8 = (float) s8 * s8; cout << "the variance for these scores is: " << (float) (V1 + V2 + V3 + V4 + V5 + V6 + V7 + V8) / N << "\n"; return 0; } linda

    C / C++ / MFC c++ help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups