: Hi Usama! : /* After this program you can find your answer for all decimal and binary values*/ : char c; : c='A'; : printf("Value %d",c); : : try it! : Dear necipakif, Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++.
: : Hi Usama! : : /* After this program you can find your answer for all decimal and binary values*/ : : char c; : : c='A'; : : printf("Value %d",c); : : : : try it! : : : Dear necipakif, : Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++. : : Thanks, : Usama. [purple] this shud work under turbo c++:[code] #include #include
int main() { char c = 'A'; clrscr(); printf("%d", c); getch(); return 0; } [/code] turbo c++ is veeeeery old and outdated compiler. better if u can avoid using it. [/purple] [hr][purple]~Donotalo()[/purple]
: : Hi Usama! : : /* After this program you can find your answer for all decimal and binary values*/ : : char c; : : c='A'; : : printf("Value %d",c); : : : : try it! : : : Dear necipakif, : Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++. : : Thanks, : Usama. :
[blue] printf does work in Turbo C++ 3.0, but it is a C function. If you want C++, try this. [code] #include "iostream.h"
: : : Hi Usama! : : : /* After this program you can find your answer for all decimal and binary values*/ : : : char c; : : : c='A'; : : : printf("Value %d",c); : : : : : : try it! : : : : : Dear necipakif, : : Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++. : : : : Thanks, : : Usama. : : : : [blue] : printf does work in Turbo C++ 3.0, but it is a C function. : If you want C++, try this. : [code] : #include "iostream.h" : : int main(int argc, char* argv[]) : { : char ch = 'H'; : cout << ch << " dec Value=" << dec << (int)ch << endl; : cout << ch << " oct Value=" << oct << (int)ch << endl; : cout << ch << " hex Value=" << hex << (int)ch << endl; : return 0; : } : [/code] : [/blue] : : [green]...and if you want to do it in C, you can use printf for dec and hex, by binary is a little harder. You are going to have to learn about binary operators, AND, OR, XOR...I can't explain it now, but its more that a simple switch or thing...
Comments
/* After this program you can find your answer for all decimal and binary values*/
char c;
c='A';
printf("Value %d",c);
try it!
: /* After this program you can find your answer for all decimal and binary values*/
: char c;
: c='A';
: printf("Value %d",c);
:
: try it!
:
Dear necipakif,
Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++.
Thanks,
Usama.
: : /* After this program you can find your answer for all decimal and binary values*/
: : char c;
: : c='A';
: : printf("Value %d",c);
: :
: : try it!
: :
: Dear necipakif,
: Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++.
:
: Thanks,
: Usama.
[purple]
this shud work under turbo c++:[code]
#include
#include
int main()
{
char c = 'A';
clrscr();
printf("%d", c);
getch();
return 0;
}
[/code]
turbo c++ is veeeeery old and outdated compiler. better if u can avoid using it.
[/purple]
[hr][purple]~Donotalo()[/purple]
: : /* After this program you can find your answer for all decimal and binary values*/
: : char c;
: : c='A';
: : printf("Value %d",c);
: :
: : try it!
: :
: Dear necipakif,
: Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++.
:
: Thanks,
: Usama.
:
[blue]
printf does work in Turbo C++ 3.0, but it is a C function.
If you want C++, try this.
[code]
#include "iostream.h"
int main(int argc, char* argv[])
{
char ch = 'H';
cout << ch << " dec Value=" << dec << (int)ch << endl;
cout << ch << " oct Value=" << oct << (int)ch << endl;
cout << ch << " hex Value=" << hex << (int)ch << endl;
return 0;
}
[/code]
[/blue]
: : : /* After this program you can find your answer for all decimal and binary values*/
: : : char c;
: : : c='A';
: : : printf("Value %d",c);
: : :
: : : try it!
: : :
: : Dear necipakif,
: : Thanks for your help, but I am using Turbo C++ 3.0 compiler so please write code according to that as I the code which you have written does not work correctlt in Turbo C++.
: :
: : Thanks,
: : Usama.
: :
:
: [blue]
: printf does work in Turbo C++ 3.0, but it is a C function.
: If you want C++, try this.
: [code]
: #include "iostream.h"
:
: int main(int argc, char* argv[])
: {
: char ch = 'H';
: cout << ch << " dec Value=" << dec << (int)ch << endl;
: cout << ch << " oct Value=" << oct << (int)ch << endl;
: cout << ch << " hex Value=" << hex << (int)ch << endl;
: return 0;
: }
: [/code]
: [/blue]
:
:
[green]...and if you want to do it in C, you can use printf for dec and hex, by binary is a little harder. You are going to have to learn about binary operators, AND, OR, XOR...I can't explain it now, but its more that a simple switch or thing...
gotta go
{2}rIng[/green]