I turned in this code.
#include <iostream>
using namespace std;
int adder(int temp);
int main()
{
// beginning values
int n=6;
int *num=&n;
// printout values
cout << "In main, we start with these values" << endl;
cout << "value of n - " << n << endl;
cout << "Value of *num - " << *num << endl;
cout << "Value of &num -" << &num << endl;
//jump to adder function
*num=adder(*num);
// printout new values
cout << "\n\nBack in main we get this result." << endl;
cout << "value of n - " << n << endl;
cout << "Value of *num - "<< *num << endl;
cout << "Value of &num -"<< &num << endl;
cout << "\n\n" << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
int adder(int temp){
temp++;
cout << "\n\nIn the 'adder' function we change *num to " << temp << endl;
return (temp);
}
Friday, he gave me a "C", and said he would not accept my 4 apologies. I must have given him the dear in the headlights look because, before I could say anything else he said "Comments are nothing more than an apology... figure it out." I figure he must like me, 67% of the class failed.
First, Is there anything wrong with the code?
Second, Any notion to his apology remark?
Edited by macosxnerd101: Title renamed to be more descriptive.

New Topic/Question
Reply
MultiQuote










|