I think this is what you wanted? Your original code does run after doing the compiling. I compiled with M$ visual C++ 2008 express edition (on Vista 32 bit home edition)
1.Open start menu
2. In the search box, type CMD and press Enter when CMD is found
3. open up the folder where your EXE exists if not already there. Then type in name of program.
4. I did the above three steps and I see following (and I just saved the file as "jack.exe in a folder named C++")
NOTE: don't just double click EXE to attempt running it, actually manually open CMD then run it. Else, the program might just exit too quickly for you to see actually the result. This might be why you think program is not working, or you only see a quick flash and then nothing again IF you are sure that you have followed the appropriate steps to compiling your code via your compilerHere is screenshot of result:
Here is code I compiled:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
char clr[5] = {'o','h','d','s','c'};
char nmr[10] = {'0','A','J','Q','K','@','#','7','8','9'};
cout << "The Jack of Spades (3;2) is abbreviated: " << clr[3] << "" << nmr[2];
cout << "How Awesome...";
cin.get();
return 0;
}
I got rid of int a, because it is an unused variable as is. Don't know what you wanted use a to do. And I find M$ Visual C++ express edition (the free edition of their professional software) to be relatively good to use.