#include<iostream>
using namespace std;
int main()
{
int x = 0x63;
float y = 32.245;
char z = 'c';
cout<< "x is " << x << " y is " << y << " z is " << z << '\n';
z = x;
x = y;
y = z;
cout<< "x is " << x << " y is " << y << " z is " << z << '\n';
x = 0x5632; //how many bytes are needed for 0x5632?
z = x;
cout<< "x is " << x << '\n';
cout<< "z as a character is " << hex << z << "....and as integer..." << (int) z;
return 0;
}
output
x is 99 y is 32.245 z is c
x is 32 y is 99 z is c
x is 22o66
z as a character is 2....and as integer...32
using namespace std;
int main()
{
int x = 0x63;
float y = 32.245;
char z = 'c';
cout<< "x is " << x << " y is " << y << " z is " << z << '\n';
z = x;
x = y;
y = z;
cout<< "x is " << x << " y is " << y << " z is " << z << '\n';
x = 0x5632; //how many bytes are needed for 0x5632?
z = x;
cout<< "x is " << x << '\n';
cout<< "z as a character is " << hex << z << "....and as integer..." << (int) z;
return 0;
}
output
x is 99 y is 32.245 z is c
x is 32 y is 99 z is c
x is 22o66
z as a character is 2....and as integer...32
Comments
Post a Comment