// CharacterEncoding - allow the user to enter a
// numeric value the print that value
// out as a character
#include "stdafx.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(int nNumberofArgs, char* pszArgs[])
[
// Prompt the user for a value
int nValue;
cout << "Enter decimal value of char to print:";
cin >> nValue;
// Now print that value back out as a character
char cValue = (char)nValue;
cout << "The char you entered was [" << cValue
<< "]" << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
]
First, I don't think that we have parameters in the main function.
Apart from that, use curved brackets({}) in place of square brackets ([]) in line 12 and 27.
And http://www.cplusplus.com/forum/beginner/1988/
U can have parameters in the main function. The amount of arguments and the list of arguments. The first argument is the program name. Then optionally if you run from the cmd propt you can add arguments. start someprogram.exe argument1 argument2
@Paradoxx What is going wrong with it? If you are more specific about the error you are getting (runtime, compiler message, ...), we can help you more effectively. If there is a compiler error, copy and paste it on here :)
EDIT: Yes, you can have arguments in the main function (and they word as Breadman said), but equally you can omit them if you don't use them.
Alright It's fixed thanks guys!
It was 3 am in the morning when I was working on that code so I was a little drowsy, cant believe I missed the brackets! Haha, but thanks a bunches.