1,362 Posted Topics
Re: How are the integers songMin and songMax going to hold the titles of the respective first and last titles? Your branching code should be done as a series of if...else if statements - when any one of the three (not four) possible conditions is met, there's no point in continuing … | |
Re: Imagine you have a stack of papers in front of you, each with a number written on it. They are in no particular order. You can only pick up one sheet at a time, the one on top. How would you find the largest and smallest of the numbers in … | |
Re: This sounds like a homework assignment I once gave. Or maybe will give soon. Please make your best attempt at solving this problem, then post your code if you find you have difficulties. | |
Re: Passing the strings to a function is no different than passing arrays of any other type. They are, after all, just arrays. So a function prototype for you might be something like [code] void make_user_id( char name[], char id[], char user_id[] ) [/code] Note also that your code to read … | |
Re: To compare your strings, ignoring any case difference, you should first of all change the strings to all upper case or all lower case after reading them in, such as: [code] transform(names[count]begin(), names[count].end(),names[count].begin(), toupper); [/code] Use tolower as the last parameter if you want lower case. Do this to the … | |
Re: AD is right that lines 36 and 46 don't belong. Additionally, min and max should both be initialized to their respective values when you declare them in lines 13 and 14. How does the game end if the computer actually guesses the number? I would caution you about reusing this … | |
Re: To keep getting responses until a correct answer is given, [code] cin >> multi; while ( multi != number1 * number2) { cout <<"That's not it, try again'" << endl; cout << "how much is " << number1 << " times " << number2 << "?"; cin >> multi; } … | |
Re: Close [code] cout << "*" << grade; [/code] | |
Re: In line 11 do you mean to be creating a value for number of seconds in a minute, like your sph value for hours? Then you ought to have something like: mph = 60; And not use the <= that you wrote, which makes a statement that does nothing useful. … | |
Re: You are testing the eof before having read anything. What happens if your file is empty (0 length)? To properly use the eof() method, you must read something before the loop test, then read that element as the last action in your loop body, similar to: getline( myfile, identifier); while( … | |
Re: I would suggest that Google is your friend. Search for c++ tutorials and you'll find many. Only you can tell if one is suitable to your needs. Beware of any that still use the older standards for C++ - you'll spot these when they use header files such as <iostream.h> … | |
Re: If filedata is to be opened and closed in the dataExtract() function, it need not be a global, declare inside the function. As mentioned, use the appropriate file mode to set the writing action to occur at end of existing content (I'd use ios::app ). Alternatively, you could open the … |
The End.