Print

Type Conversion

Santosh Kumar Singh
Written by Santosh Kumar Singh. Posted in C & C++ on 09 August 2009.
Hot 1081 hits 0 favoured

////////////////////////////////////////
#include

////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
     // Three uninitialized variables, different types.
     char myChar;
     short int myInt;
     long myLong;

     // An initialized variable of yet another type.
     float myFloat = 7e4;

     // Assign and convert.
     myChar = myInt = myLong = myFloat;

     // Display the variables.
     std::cout << myChar;
     std::cout << ' ';
     std::cout << myInt;
     std::cout << ' ';
     std::cout << myLong;
     std::cout << ' ';
     std::cout << myFloat;

     return 0;
}


Santosh Kumar Singh

Author: Santosh Kumar Singh

294 84486 6
I am software Engineer in .net and Axapta Technology. I wrote blogs on http://daynamicsaxaptatutorials.blogspot.com...
  • No comments found
Powered by CjBlog