Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: commiedic

Search: Search took 0.01 seconds.

  1. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Pretty sure I got the code right, but I am coming up with a different answer than what I was expecting


    55 67 458 23 81 33 782 375 528 405 324 950 46 14 864 551 38 167 518 630
    The Average from...
  2. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok, so the if statements expression is only true if the remainder of the num%3 equals 0. So if there is no remainder than it is a true statement.
  3. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok, Now I had friend give me a hint on this next piece for reading every 3rd integer in the input file, but I don't know how to decipher it.

    if(num%3==0)

    I get that I will need an "if"...
  4. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Whoa... look at me go lol Thanks!


    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <fstream>
    using namespace std;

    void main()
  5. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok I got it =P


    total=0;
    counter=0;
    filein>>num;
    while(filein)
    {

    fileout<<num<<" ";
  6. Re: College Lesson Trouble With Count/Sentinel Control Loops

    This is the only way I could get it to work. Although it is still repeating the last number twice, but it is giving me the average.


    #include <iostream>
    #include <cmath>
    #include <iomanip>...
  7. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok I think I see what you are saying now. I will revise my code after my next class. Thank you for being so helpful.
  8. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok, then I will try to build it into one loop. Hopefully I got what you were saying this time. I think I understand that I was being redundant.

    So with this new build I am getting the average...
  9. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok, for the averages of the numbers here is what I am getting in my output file.


    55 67 458 23 81 33 782 375 528 405 324 950 46 14 864 551 38 167 518 630 630


    For some reason it isn't giving...
  10. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Ok I see what you are saying. Here is my new updated code. I will be moving on to the averages now.
  11. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Awesome thanks! For some reason I am also having trouble keeping the spaces and end line codes.

    I got it with:

    fileout<<num<<" ";
  12. Re: College Lesson Trouble With Count/Sentinel Control Loops

    Sorry it has been so long for me to reply. rough week...

    Here is my updated code


    #include <iostream>
    #include <cmath>
    #include <iomanip>
    #include <fstream>
    using namespace std;
  13. Re: College Lesson Trouble With Count/Sentinel Control Loops

    can't find the edit button, but I meant to say this is what I have so far. I am stuck on (A) trying to write to the ANSWER.txt file.
  14. College Lesson Trouble With Count/Sentinel Control Loops

    Hi,

    This is my first post here and I am in need with some help(might need a lot) with a lesson my professor has given me to help me understand loops.

    Here is an imgur link to my current...
Results 1 to 14 of 14


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center