First time poster, not sure if this is the right site to ask this question: So, on one of our exercise questions I've come acrossed this question. I was wondering if there is a way to write this out to do an actual test to make sure you come up with the right answer. I keep getting errors on the x.size()-5 keeps saying expression must have a class type. This is my first programming class ever and am struggling by so any help would be appreciated. The beginning has some jibberish that I use for another question problem.
#include <iostream> // preprocessor directive: enables keyboard input and display output
#include <iomanip>
#include <string> // preprocessor directive: enables work with string objects
#include <cstdlib>
using namespace std; // using declaration: eliminates need for std:: prefix on cin, cout...
void main() { // function main header along with opening brace
string enterKey; // variable to receive getline's keyboard input
cout << "\nHello world, from via Visual C++ 2010 Express"; // program output
cout << "\n\nEnd of program: Press <Enter> to exit this program."; // user prompt
int xCompare=4;
int yCompare=3;
int compareValue=2;
int loopLimit=4;
int denominator=2;
int outerLoopLimit=3;
int innerLoopLimit=2;
int total=-2;
int p_i=4;
int p_j=4;
int p_k=1;
int iLimit=2;
int jLimit=3;
int kLimit=2;
int w=0;
int x=2;
int z=8;
int main();
{
int x[] =
{7,3,5,8,1,7,9,0,4,2,6};
int a=3;
int b= x.size()-5;
int f=1;
int y=0;
for (int i = b; i >= a; --i)
y += x[i];
cout << y;}
}
getline(cin, enterKey); // pause program awaiting keyboard <Enter> key
First, assume a calling function with the following local variables: 1.1) array "x" of integers with values of 71, 97, 17, 86, 41, 50, 66, 9, 7, 43, 19; and 1.2) integer variable "a" with values of 1
Second, assume a called function whose UML interface is "-mystery(y[]: int, b: int)"
Third, assume the called function's implementation has the following single statement: y[b]+=3;
Fourth, assume the calling function calls the called function passing it the following arguments: x, a
Fifth, assume after control returns to the calling function it sends the value of the following expression to the standard output streaming via the stream insertion operator: x[a]
What is displayed on the standard output device?