You will find solutions of C++ based questions given in CS Book of 'Sumita Arora' for Class XI as well as Class XII. If you have any kind of question you can ask me by simply commenting below in 'Ask Question' section/tab. Thank You ! Please '+1' if like.
what is the difference between type casting and automatic type conversion? also give a suitable c++ code to illustrate both.
ReplyDeleteType casting simply means converting the data type of any variable manually, for e.g.- if we have an in t variable 'a' storing '99' in it and we want to convert that stored value to 'char' type for any use, we can do it using 'typecasting', the following program code illustrates it:
Delete#include
#include //for using getch and clrscr
void main()
{
clrscr();
int a=99;
cout<<"the value of "<<(char)a<<"in int or ASCII is "<
#include
void main()
{clrscr();
int a=10;float b=12.5,c=0;
c=a+b; // here a is upgraded to float i.e 10.0 and
// then operation is done,after that value is returned
// as float as 'c' is of float data type
cout<<"Value calculated is "<<c<<endl;
getch();
}
Due to some limitations of blog the answer wasn't posted all acurate
ReplyDeleteso you can download the above comment as here
http://www.ziddu.com/download/19290735/Comment_Reply01.txt.html