#include \"stdafx.h\" //please disregard this as its part of visual c++ 2013 #in
ID: 441409 • Letter: #
Question
#include "stdafx.h" //please disregard this as its part of visual c++ 2013
#include <iostream>
{
int alpha[15]; //Declare an array alpha of 15 components of type int.
cout << alpha[9]; //Output the value of the 10th component of the alpha array
alpha[4] = 35; //Set the value of the 5th component of the alpha array to 35.
alpha[8] = alpha[5] + alpha[12]; //Set the value of the 9th component of the alpha array to the sum of the 6th and 13th components of the alpha array.
alpha[3] = 3*alpha[7] - 57; //Set the value of the 4th component of the alpha array to three times the value of the 8th component minus 57
for(int i=0; i<15; i++) //Output alpha so that five components per line are printed
{
if(i%5 ==0)
cout << endl;
cout << alpha[i];}
}
I keep getting error C2447: '{' : missing function header (old-style formal list?)
Any idea what this is? I tried removing semicolons thinking that might be causing the problem, but it didnt solve.
Explanation / Answer
#include<stdafx.h> //please disregard this as its part of visual c++ 2013
using namespace std;
#include <iostream>
int main()
{
int alpha[15]; //Declare an array alpha of 15 components of type int.
cout << alpha[9]; //Output the value of the 10th component of the alpha array
alpha[4] = 35; //Set the value of the 5th component of the alpha array to 35.
alpha[8] = alpha[5] + alpha[12]; //Set the value of the 9th component of the alpha array to the sum of the 6th and 13th components of the alpha array.
alpha[3] = 3*alpha[7] - 57; //Set the value of the 4th component of the alpha array to three times the value of the 8th component minus 57
for(int i=0; i<15; i++) //Output alpha so that five components per line are printed
{
if(i%5 ==0)
cout << endl;
cout << alpha[i];
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.