Help for a New programmer
-
Hi. I am taking my first programming class and I am trying to write a sample void function. Would anyone be willing to show me what I am doing wrong? Here is what I have so far: #include using namespace std; void GetNumbers(int&, int&, int&); int main () { int a; int b; int c; int average; GetNumbers (a,b,c); average=(a+b+c)/3; cout << "The average of your numbers is"<< average << endl; } Void GetNumbers(int& firstnumber, int& secondnumber, int& thirdnumber) { cout<< "enter three numbers" <>firstnumber>>secondnumber>>thirdnumber; }
-
Hi. I am taking my first programming class and I am trying to write a sample void function. Would anyone be willing to show me what I am doing wrong? Here is what I have so far: #include using namespace std; void GetNumbers(int&, int&, int&); int main () { int a; int b; int c; int average; GetNumbers (a,b,c); average=(a+b+c)/3; cout << "The average of your numbers is"<< average << endl; } Void GetNumbers(int& firstnumber, int& secondnumber, int& thirdnumber) { cout<< "enter three numbers" <>firstnumber>>secondnumber>>thirdnumber; }
-
Hi. I am taking my first programming class and I am trying to write a sample void function. Would anyone be willing to show me what I am doing wrong? Here is what I have so far: #include using namespace std; void GetNumbers(int&, int&, int&); int main () { int a; int b; int c; int average; GetNumbers (a,b,c); average=(a+b+c)/3; cout << "The average of your numbers is"<< average << endl; } Void GetNumbers(int& firstnumber, int& secondnumber, int& thirdnumber) { cout<< "enter three numbers" <>firstnumber>>secondnumber>>thirdnumber; }
It would help to know what the output is, but (a+b+c)/3 is integer arithmetic and the decimal part of the answer will be truncated. Try using "float"s instead of "int"s The maximum characters for the signature is five hundred. I was wondering how long a five hundred characters message would be, so I decided to make my signature 500 characters long. I'm sure if I had some cool html stuff in my signature, I could eat up five hundred characters, but just typing five hundred characters takes quite some time. The trick I think is finding something to say, but I'm usually a man of few words. So I guess I'll tell you what I've discovered is the secret to life. It
-
Hi. I am taking my first programming class and I am trying to write a sample void function. Would anyone be willing to show me what I am doing wrong? Here is what I have so far: #include using namespace std; void GetNumbers(int&, int&, int&); int main () { int a; int b; int c; int average; GetNumbers (a,b,c); average=(a+b+c)/3; cout << "The average of your numbers is"<< average << endl; } Void GetNumbers(int& firstnumber, int& secondnumber, int& thirdnumber) { cout<< "enter three numbers" <>firstnumber>>secondnumber>>thirdnumber; }
-
It would help to know what the output is, but (a+b+c)/3 is integer arithmetic and the decimal part of the answer will be truncated. Try using "float"s instead of "int"s The maximum characters for the signature is five hundred. I was wondering how long a five hundred characters message would be, so I decided to make my signature 500 characters long. I'm sure if I had some cool html stuff in my signature, I could eat up five hundred characters, but just typing five hundred characters takes quite some time. The trick I think is finding something to say, but I'm usually a man of few words. So I guess I'll tell you what I've discovered is the secret to life. It
-
maybe you should try acquiring each number one at a time within your void function. Also, what are you including?