im trying to get this output .
PRINTING CONTENTS OF ARRAY USING THE MOD Option
=====================================================
Even Numbered Element = 0 Contents of Element within Array is = A
Even Numbered Element = 2 Contents of Element within Array is = C
Even Numbered Element = 4 Contents of Element within Array is = E
Even Numbered Element = 6 Contents of Element within Array is = G
Even Numbered Element = 8 Contents of Element within Array is = I
Even Numbered Element = 10 Contents of Element within Array is = K
Even Numbered Element = 12 Contents of Element within Array is = M
Even Numbered Element = 14 Contents of Element within Array is = O
Even Numbered Element = 16 Contents of Element within Array is = Q
Even Numbered Element = 18 Contents of Element within Array is = S
Even Numbered Element = 20 Contents of Element within Array is = U
Even Numbered Element = 22 Contents of Element within Array is = W
Even Numbered Element = 24 Contents of Element within Array is = Y
here is the code i came up i think i got the letters but i cant get the number to be correspond.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
cout << "\n\n\nPRINTING CONTENTS OF ARRAY USING THE MOD Option" << endl
<< "====================================" << endl;
char* modpstr[] = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
int modnumber = 0;
for(i = 0; modpstr[ i ]; i++)
{
cout << "Even Numbered Element = " << modnumber << " Contents of Element within Array is = " << modpstr[i++]<< endl;
}
system("PAUSE");
return 0;
}
|