Okay well I seen my teacher is like trying to set us up for failure.. Look at these codes and the questions she asks..
#include <iostream>
using namespace std;
void prod ( int, int, int& );
void main ()
{
int a =1, b =2, c =1;
prod(a,b,c);
prod(c,b,a);
prod(c,a,b);
}
void prod ( int w, int x, int& y )
{
y = w * x;
}
Like what the hell is that? It returns nothing and thats how she put it and asked what is the final value of a, b, & c..
Another code:
for ( int i = 0; i < 10; i++ )
{
scores[i] = i * i;
happy[i+10] = scores[i];
}
Then I am suppose to figure out scores[0], scores[9], scores[10], happy[0], & happy[19].
Last code is
index = -1;
mystery = 50;
for ( int i =0; i < 10; i++ )
{
if ( scores[i] == mystery )
{
index = i;
cout << index << endl;
}
}
Then she asks what is displayed, what if mystery equals 55, & what happens when it is if ( scores = mystery ).
Now what the heck am I suppose to do with those bits?! They are missing tons, but she wants me to figure out these questions (and no I am not suppose to correct the code or use Visual Studio).
Any help or maybe I am going to far into this??
Also I need to make a program that calculates the square of a number, the cube of a number, add 1 to the number, subtract 1 from the number, and provide option to choose..
Any guidance on that one will be appreciated as well!
Question
YounGMessiah
Okay well I seen my teacher is like trying to set us up for failure.. Look at these codes and the questions she asks..
#include <iostream> using namespace std; void prod ( int, int, int& ); void main () { int a =1, b =2, c =1; prod(a,b,c); prod(c,b,a); prod(c,a,b); } void prod ( int w, int x, int& y ) { y = w * x; }Like what the hell is that? It returns nothing and thats how she put it and asked what is the final value of a, b, & c..
Another code:
for ( int i = 0; i < 10; i++ ) { scores[i] = i * i; happy[i+10] = scores[i]; }Then I am suppose to figure out scores[0], scores[9], scores[10], happy[0], & happy[19].
Last code is
index = -1; mystery = 50; for ( int i =0; i < 10; i++ ) { if ( scores[i] == mystery ) { index = i; cout << index << endl; } }Then she asks what is displayed, what if mystery equals 55, & what happens when it is if ( scores = mystery ).
Now what the heck am I suppose to do with those bits?! They are missing tons, but she wants me to figure out these questions (and no I am not suppose to correct the code or use Visual Studio).
Any help or maybe I am going to far into this??
Also I need to make a program that calculates the square of a number, the cube of a number, add 1 to the number, subtract 1 from the number, and provide option to choose..
Any guidance on that one will be appreciated as well!
Link to comment
Share on other sites
31 answers to this question
Recommended Posts