Please help me with the queried in blue. Thank you. By the way, I'm not getting the editor toolbar and I had to use captcha to enter the forums.
//learning int(x), float(x), etc.cpp
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
float x = 4.5;
cout << "x = " << x << endl;
cout << "x = " << int(x) << endl;
[b][color="blue"]//as you can see "x" is being cast, what's this type of cast called?[/color][/b]
cout << "x = " << static_cast<int>(x) << endl;
int(y)=8;
[b][color="blue"]//what's the advantage of using this syntax to use declare and initialize a variable?[/color][/b]
cout << "y = " << y << endl;
system("pause");
return 0;
}
Edited by jackson6612, 24 November 2011 - 05:51 AM.


Sign In
Create Account


Back to top









