Search results

  1. M

    Comp Sci C++ object oriented, classes/methods

    The only thing I didn't understand was the srand(...) part. From there I can follow what the loops are doing, which is why I questioned the need for a nested for loop. The function I was looking at was actually labeled as a shuffle() method. It was dealing with a deck of cards, and the...
  2. M

    Comp Sci C++ object oriented, classes/methods

    Ok, I've got my shuffle working, (a classmate pointed me in the direction of some sample code from our lecture notes) Here is the shuffle method I used: void Song_Library::shuffle() { int Swap; Song temp; srand(time(0)); for(int index = 0; index < SIZE; index++) {...
  3. M

    Comp Sci C++ object oriented, classes/methods

    As I said, it was a misguided effort. The random() function, was what I thought was like a "default" operator. Ok, so do I need to change it to " int location = index" and then move it down into my for loop. I was using my other sort methods as examples for this one. Following that...
  4. M

    Comp Sci C++ object oriented, classes/methods

    We have not been made aware of any debuggers. We are just using nano on an Ubuntu server we are accessing via a secure shell. I uncommented the getline... pieces and took out the other ones, and it is reading and sorting correctly now. Thanks! Now I'm having trouble with the shuffle...
  5. M

    Comp Sci C++ object oriented, classes/methods

    Homework Statement The problem statement is very long, but in a pinch, I'm supposed to take a text file and use 2 different classes, Song class, and Song_Library class to sort, print, etc.. I'm running into the problem(among others) of my output being really really dumb. And I think it's in...
  6. M

    Comp Sci Input/output using loops c++

    I'm not hip to the coding format. :) The reason that made sense to me, and forgive my terminology, because the while loop is the input statement that is being requested by the proceeding output statement. Basically I went through and indented it so that it was clear to me what followed what...
  7. M

    Comp Sci Input/output using loops c++

    #include <iostream> using namespace std; int main () { //Defining variables that will be used during code. float CreditHours; int LetterGrade = 0; float Total; float TotalCredits = 0; float TotalPoints = 0; while (LetterGrade != -1) { //Updating Totals Total = LetterGrade *...
  8. M

    Comp Sci Input/output using loops c++

    Homework Statement I'm to write a program that calculates GPA using loops to allow numerous inputs and using Error checking to be sure that inputs are valid. I'm having trouble figuring out how to make my loop repeat if a the input is invalid. And I'm also having a little trouble with the...
  9. M

    Comp Sci Simple input output program C++

    Yeah we have not learned about loops and arrays, we are actually specifically told we can't use them in that assignment, and actually the next assignment calls for us to improve upon our code using loops and more conditional statements but once again, no arrays.
  10. M

    Comp Sci Simple input output program C++

    I'm not sure where the asterisks came from, other than in my multiplication, those shouldn't be there, I imagine its just from several copy and pastes from different formats.
  11. M

    Comp Sci Simple input output program C++

    Sorry, I wasn't clear, the assignment called for the program to calculate GPA based on 5 inputs. And in my code I made comments that told the grader what I was doing and what the variables stood for. Here is my code, its already been submitted but when asking for help in writing it the TA did...
  12. M

    Comp Sci Simple input output program C++

    Thanks I got out figured out a little bit ago, I was just choosing x, y, z as an example my actual variables were c1-c5 and g1-g5.
  13. M

    Comp Sci Simple input output program C++

    So if I'm designated the input as a variable I.e cin >>x>>y>>z; Then I would have to define A B C D or F for every input? So I would do if (input=='A') x=4; etc.. for every letter grade and every variable, x, y, z?
  14. M

    Comp Sci Simple input output program C++

    I have a homework assignment that requires me to write a program in c++ to calculate GPA. The assignment wants then input of the grade to be in terms of just A B C, etc.. I'm just having trouble assigning a number value to the user input ie when the user inputs an A for their grade, I need the...
Top