Whenever I try to start debugging it, it says 'M' is being used without being initialized...I want to rip my hair out -_______-
What I have to do:
A void function named mostPowerful
o That accepts three Jetpack power output measurements in MW as double values.
o Returns the largest power output and the number of the Jetpack as parameters.
o Return a 1 for the number if the first Jetpack’s power output is the largest, a 2 if the second Jetpack’s power output is the largest, and a 3 if the third Jetpack’s power output is the largest.
What I have:
#include <iostream>
using namespace std;
And while I'd harp on you for using namespace STD, as well as system("PAUSE"), It will be fine for a program of this simplicity... just try to not use either of those on future programs. There's a forum thread on the first page of this subforum explaining why not to use system("PAUSE"). As for using namespace STD... well, the example I recall reading is that say you have two namespaces, foo and bar. Say that foo has the function quut(int a), which you use in a program. However, if bar were to update and suddenly have a function quut(int a) with an entirely different function, there would be quite the issue in your code. Hence why it is poor coding practice to use namespace STD. What you can do instead is state STD:: in front of every instance of a function that is namespace STD, such as cout, cin, and string. Also, \n is your friend.
I have no idea what you guys are saying. I tried the if (option == M) but it said the same thing. My teacher is being difficult, he never really told us about using namespace std and system("PAUSE")...he just says we need it in order for the program to work.
Yes, M is a variable- and it doesn't need to be. He could instead just not make it a variable due to it being otherwise pointless to have as a variable. He's checking whether option is equal to M, which in this case based on what his code is, should hold the letter M. I think that is the confusion.
Can you please explain that. I'm sorry I'm not comprehending..english is not my first language. You are saying that I shouldn't use variables? I'm sorry I'm irritating and not understanding..