Page 1 of 2 12 LastLast
Results 1 to 25 of 35
  1. #1
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    it'd be alot cooler if someone did

  2. #2
    Appoggiatura
    Post Count
    744
    NBA Team
    San Antonio Spurs
    I know a bit but Im no specialist, whats your problem?

  3. #3
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    Write a program that reads records from an input file (prog5inp.txt). Each record contains a student ID#, the student’s semester average, and the student’s assigned letter grade. The program determines how many of each letter grade was assigned and writes in tabular form the input values plus the ‘calculated’ values to an output file, prog5out.txt. Do not use functions other than main to solve this problem. All code should be kept inline. Do not use classes or arrays.

    I'm supposed to use a count loop

  4. #4
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    general form

    declare loop index variable

    for (initialize loop index variable; test logical expression ; increment)
    {
    execute statement(s);
    }


    e.g.

    #include <iostream>

    int main()
    {
    int i;

    for (i = 4; i >= 1; i = i - 1)
    {
    cout << " o" << endl;
    }

    return 0;
    }
    this is an example of a count loop, i'm just not sure how to plug it in to the program using what I need. C++ is so particular which makes it so complicated

  5. #5
    Appoggiatura
    Post Count
    744
    NBA Team
    San Antonio Spurs
    I'm not familiar with the term "count loop" if that has a meaning of its own, but it doesn't seem like a really hard program to do.

    You read the input file, while the id doesnt changes for each record you add one to the according counter (one for each possible grade letter).

    Once the Id changes you write the output record with the totals in the counters, and then you reset them to zero.

  6. #6
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    I'm not familiar with the term "count loop" if that has a meaning of its own, but it doesn't seem like a really hard program to do.

    You read the input file, while the id doesnt changes for each record you add one to the according counter (one for each possible grade letter).

    Once the Id changes you write the output record with the totals in the counters, and then you reset them to zero.
    so then(using previous example)~
    #include <iostream>

    int main()
    {
    int number_of_student;

    for (number_of_student = 1; number_of_student >= 1; number_of_student = number_of_student + 1)
    {
    cout >> student_id >> student_smstr_avg >>
    student_grade;
    }

    return 0;
    }

    ??

    thats totally wrong isnt it?

  7. #7
    Appoggiatura
    Post Count
    744
    NBA Team
    San Antonio Spurs
    In C, for acts as a while structure, so you could do something like this

    int main()
    {

    openfile

    for (file.movefirst; file.eof(); file.movenext)
    {
    count grades and write output
    }

    closefile

    return 0;
    }

    Sorry, I dont remember C++ syntaxis

  8. #8
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    I'm not familiar with the term "count loop" if that has a meaning of its own, but it doesn't seem like a really hard program to do.

    You read the input file, while the id doesnt changes for each record you add one to the according counter (one for each possible grade letter).

    Once the Id changes you write the output record with the totals in the counters, and then you reset them to zero.
    how does it know when to stop?

  9. #9
    Appoggiatura
    Post Count
    744
    NBA Team
    San Antonio Spurs
    how does it know when to stop?
    When the Id changes, you'd need to store in a variable the previous read Id.

  10. #10
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    When the Id changes, you'd need to store in a variable the previous read Id.
    thanks danyel, i'll try it out some more

  11. #11
    Nicely Browned katyon6th's Avatar
    Post Count
    6,478
    NBA Team
    San Antonio Spurs
    They taught us VB in school.

    VB.

  12. #12
    Veteran
    Location
    here
    Post Count
    294
    NBA Team
    San Antonio Spurs
    VB's kinda ok if you're into Windows.

    I learned C/C++ because I had to for EE, but I wouldn't be caught dead programming something for myself in those languages. I like Ruby, Perl and Python best.

  13. #13
    Basketball Expertise spurster's Avatar
    Post Count
    4,132
    NBA Team
    San Antonio Spurs
    Someone needs us to do this/her homework?

    Can't you just copy most of what you need out of your textbook? You know, that thing made out of dead trees that you are supposed to read.

  14. #14
    No More Pink NorCal510's Avatar
    Post Count
    6,332
    NBA Team
    Golden State Warriors
    Damn u got a c+ thats a good ass grade

  15. #15
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    Someone needs us to do this/her homework?

    Can't you just copy most of what you need out of your textbook? You know, that thing made out of dead trees that you are supposed to read.
    no asshole
    my dumbass teacher told us we probably wouldnt need the textbook

    now i'm here wondering if I somehow got stuck into an upper level programming course where everyone seems to be 10 lessons ahead of me

  16. #16
    Veteran
    Location
    here
    Post Count
    294
    NBA Team
    San Antonio Spurs
    That problem you were assigned is pretty simple. It's par for an introductory course.

    But, as with any class in CS/SE/programming, it's normal to see people who are light years ahead of you.

  17. #17
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    That problem you were assigned is pretty simple. It's par for an introductory course.

    But, as with any class in CS/SE/programming, it's normal to see people who are light years ahead of you.
    It would be very simple were it not for the conditions she placed on the program.

    i think i'm one of two people in that class who are not CS majors

  18. #18
    Veteran
    Location
    here
    Post Count
    294
    NBA Team
    San Antonio Spurs
    You don't need classes or arrays for this problem.

    I agree that not being able to use functions is pretty ing stupid, though. That just makes your program longer and harder for your teacher to read, and harder to debug.

  19. #19
    John's Woman Carie's Avatar
    Post Count
    742
    NBA Team
    San Antonio Spurs
    It would be very simple were it not for the conditions she placed on the program.

    i think i'm one of two people in that class who are not CS majors
    That is pretty basic logic for any programming class. But if most people in your class are way ahead of you, she may be adjusting how she teaches to their level. Sorry

  20. #20
    John's Woman Carie's Avatar
    Post Count
    742
    NBA Team
    San Antonio Spurs
    I agree that not being able to use functions is pretty ing stupid, though. That just makes your program longer and harder for your teacher to read, and harder to debug.
    I disagree. I think for a basic class, they are learning the logic behind the functions.

  21. #21
    NBA = RIGGED thispego's Avatar
    Location
    Lubbock, TX
    Post Count
    12,596
    NBA Team
    San Antonio Spurs
    That is pretty basic logic for any programming class. But if most people in your class are way ahead of you, she may be adjusting how she teaches to their level. Sorry
    it's cool, ive pretty much come to terms with it, but what pisses me off is that she is making little to no effort to help me along.
    3 summer classes = little time to devote to each outside of class

  22. #22
    Since 1979 Das Texan's Avatar
    Name
    Adam Rabel
    Location
    San Antonio de Bejar
    Post Count
    5,340
    NBA Team
    San Antonio Spurs
    College
    St. Mary's Rattlers
    I truly abhor C and C ++ programming languages.

  23. #23
    Veteran
    Location
    here
    Post Count
    294
    NBA Team
    San Antonio Spurs
    I disagree. I think for a basic class, they are learning the logic behind the functions.
    Well, that's true. Some students learn better with the sadistic approach

  24. #24
    TRU 'cross mah stomach LaMarcus Bryant's Avatar
    Location
    Moldova
    Post Count
    5,731
    NBA Team
    San Antonio Spurs
    no asshole
    my dumbass teacher told us we probably wouldnt need the textbook

    now i'm here wondering if I somehow got stuck into an upper level programming course where everyone seems to be 10 lessons ahead of me

    Shrda, c++ was the language people are taught in high school, brah.

  25. #25
    Believe. Man Sauce's Avatar
    Post Count
    163
    NBA Team
    San Antonio Spurs
    Do you go to Southwest Texas State?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •