<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1168125206956184142</id><updated>2012-01-29T22:34:13.295-08:00</updated><category term='visual'/><category term='control'/><category term='SEQUENCES'/><category term='dll'/><category term='Technology'/><category term='encoding'/><category term='purpose'/><category term='false'/><category term='intersectrect'/><category term='method'/><category term='template'/><category term='pause'/><category term='library'/><category term='test'/><category term='Hover Button'/><category term='sudoku'/><category term='download'/><category term='timer'/><category term='Mathematics'/><category term='CPU'/><category term='visual   c++'/><category term='biology'/><category term='sink'/><category term='function'/><category term='conclusion'/><category term='True'/><category term='hpver button'/><category term='sheet'/><category term='c++  conditional return example'/><category term='selectstockobject'/><category term='statement'/><category term='code'/><category term='c++'/><category term='suffering'/><category term='sop'/><category term='elements'/><category term='multiple'/><category term='cooling'/><category term='two tooltips'/><category term='math'/><category term='choice'/><category term='overloaded'/><category term='business'/><category term='decoding'/><category term='visual  s'/><category term='of'/><category term='tatusbar'/><category term='vc++'/><category term='heap'/><category term='cpr'/><category term='process'/><category term='example'/><category term='tutorial'/><category term='chaining'/><category term='program'/><category term='definition'/><category term='devide'/><category term='sorting class'/><category term='dual action'/><category term='exe'/><category term='InflateRect'/><category term='sample'/><category term='button'/><category term='PATTERNS'/><category term='time'/><category term='c'/><category term='setw'/><category term='essay'/><category term='hydrogen'/><category term='problems'/><category term='MFC'/><category term='Terms'/><category term='c++  toolbar'/><category term='call'/><category term='two states tasho'/><category term='task'/><category term='Huffman'/><category term='thousand'/><category term='history'/><category term='HCF'/><category term='microsoft'/><category term='CRect'/><category term='CFormView'/><category term='methods'/><category term='celcius'/><category term='result'/><category term='Information'/><category term='Sparse matrix'/><category term='questions'/><category term='NUMBER'/><category term='university'/><title type='text'>visual c++ samples   and examples</title><subtitle type='html'>visual c++  samples and examples blog contains tutorials on Toolbar ,statusbar, timers ,hover buttons,inflaterect, intersectrect,tooltips, dll ,

These applications and tutorials    contains  codes   working programs  plus  explanation in steps  doing these  application 

The lessons include code ,descriptions plus images to illustrate the steps to create the application  and download

Each one of the modules fully explained functions to help you how to make the project</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6741117858474738494</id><published>2010-11-25T00:02:00.000-08:00</published><updated>2010-11-25T00:02:07.793-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sparse matrix'/><title type='text'>Sparse Matrix</title><content type='html'>Sparse Matrix&lt;br /&gt;&lt;br /&gt;Numerical analysis in which&amp;nbsp; a matrix most elements are zeros &lt;br /&gt;&lt;br /&gt;&amp;nbsp;Introduction&lt;br /&gt;&amp;nbsp;in some situation we face with matrix that they have a lot of zeros  element and as you know it is not necessary to multiple,add,... all of  them.if there exists a way to ignore them then the matrix algorithms go  better and more efficient.&lt;br /&gt;so we can store matrix as list and everywhere that the element is zero we dont store it but in referencing to it we return zero.&lt;br /&gt;if you do a quick look at&amp;nbsp; it you can see the algorithm,and if you run it you will enjoy&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//in the name of allah&lt;br /&gt;#include&lt;iostream&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;class sparseElem{&lt;br /&gt;&amp;nbsp; public:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int row,col;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;};&lt;/iostream&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;class sparseMatrix{&lt;br /&gt;&amp;nbsp; public:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int n,m;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *head_col;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *head_row;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem*c;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *r;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m=3;n=3;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_col=head_row=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=new sparseElem[n];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r=new sparseElem[m];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&lt;m;i++)&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].row=i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&lt;n;i++)&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[i].col=i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix(int m1,int n1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m=m1;n=n1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_col=head_row=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=new sparseElem[n];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r=new sparseElem[m];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&lt;m;i++)&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].row=i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i=0;i&lt;n;i++)&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[i].col=i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void setElem(int i,int j,double x){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *tmp=new sparseElem;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;row=i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;col=j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;value=x;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //important&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextRow=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //point&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextCol=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!head_row){//head_row=head_col=NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_row=r+i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_col=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].nextRow=tmp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].nextCol=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[j].nextCol=tmp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[j].nextRow=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextRow=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextCol=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *pc=head_col;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *lpc=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(pc-&amp;gt;nextRow!=NULL &amp;amp;&amp;amp; tmp-&amp;gt;col&amp;gt;pc-&amp;gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"while 1"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpc=pc;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc=pc-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tmp-&amp;gt;col &amp;lt; pc-&amp;gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lpc)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpc-&amp;gt;nextRow=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_col=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (c+j)-&amp;gt;nextRow=pc;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[j].nextCol=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //new&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(tmp-&amp;gt;col &amp;gt; pc-&amp;gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc-&amp;gt;nextRow=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[j].nextRow=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //new added&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; maybe error&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[j].nextCol=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //new added maybe optional&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else//both are equal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //fixing r[i] ha &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *pr=head_row;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *lpr=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(pr-&amp;gt;nextCol!=NULL &amp;amp;&amp;amp; tmp-&amp;gt;row &amp;gt; pr-&amp;gt;row){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"while 2"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpr=pr;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr=pr-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tmp-&amp;gt;row &amp;lt; pr-&amp;gt;row){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lpr)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpr-&amp;gt;nextCol=r+i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; head_row=r+i;//the first element is inserting;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (r+i)-&amp;gt;nextCol=pr;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].nextRow=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //new&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(tmp-&amp;gt;row&amp;gt;pr-&amp;gt;row){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr-&amp;gt;nextCol=r+i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].nextCol=NULL;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //new added&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r[i].nextRow=NULL;//r[i].nextCol=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else//both are equal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr=r+i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //fixing adding element to a others in sparseMatrix&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *pc2=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *lpc2=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(pc2-&amp;gt;nextCol!=NULL &amp;amp;&amp;amp;pc2-&amp;gt;nextCol-&amp;gt;row&lt;tmp-&gt;row){&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpc2=pc2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc2=pc2-&amp;gt;nextCol;//chon dar haman sotun search mikonim&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //agar az ghabk vojud dash faghat value ra be an midahim vagarne hame chiz be ham mirizad va hafeze ezafe mibarad&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(pc2-&amp;gt;nextCol &amp;amp;&amp;amp; pc2-&amp;gt;nextCol-&amp;gt;row ==tmp-&amp;gt;row)//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! if(pc2-&amp;gt;nextCol &amp;amp;&amp;amp; pc2-&amp;gt;nextCol-&amp;gt;row&amp;gt;tmp-&amp;gt;row)//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new&amp;nbsp;&amp;nbsp; error if(pc2-&amp;gt;nextCol )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc2-&amp;gt;nextCol-&amp;gt;value=tmp-&amp;gt;value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //tmp=NULL;//delete tmp; next is&amp;nbsp; deleting it in below&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {//if(pc2-&amp;gt;nextCol &amp;amp;&amp;amp; pc2-&amp;gt;nextCol-&amp;gt;row &amp;gt; tmp-&amp;gt;row){//``````````````````completely new&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpc2=pc2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextCol=lpc2-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc2-&amp;gt;nextCol=tmp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *pr2=r+i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *lpr2=NULL;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(pr2-&amp;gt;nextRow!=NULL &amp;amp;&amp;amp;pr2-&amp;gt;nextRow-&amp;gt;col&lt;tmp-&gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpr2=pr2;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr2=pr2-&amp;gt;nextRow;//chon dar haman sotun search mikonim&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(pr2-&amp;gt;nextCol &amp;amp;&amp;amp; pr2-&amp;gt;nextRow-&amp;gt;col ==tmp-&amp;gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete tmp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{// if(pc2-&amp;gt;nextCol &amp;amp;&amp;amp; pc2-&amp;gt;nextCol-&amp;gt;col &amp;gt; tmp-&amp;gt;col){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lpr2=pr2;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new error //lpr2=lpr;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;nextRow=lpr2-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr2-&amp;gt;nextRow=tmp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; double getElem(int i,int j){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *pc=c+j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(pc==NULL)//if there is no element in matrix returns 0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(pc-&amp;gt;nextCol!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pc=pc-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(pc-&amp;gt;row==i)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return pc-&amp;gt;value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if(pc-&amp;gt;row&amp;gt;i)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;//if the row has been passed&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix *sparseAdd(sparseMatrix &amp;amp;A,sparseMatrix &amp;amp;B){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix* C=new sparseMatrix(m,n);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *apr=A.head_row;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(apr!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem* ap=apr-&amp;gt;nextRow;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(ap){//p!=null&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C-&amp;gt;setElem(ap-&amp;gt;row,ap-&amp;gt;col,A.getElem(ap-&amp;gt;row,ap-&amp;gt;col));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ap=ap-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apr=apr-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *bpr=B.head_row;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(bpr!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem* bp=bpr-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(bp){//p!=null &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value=C-&amp;gt;getElem(bp-&amp;gt;row,bp-&amp;gt;col)+B.getElem(bp-&amp;gt;row,bp-&amp;gt;col);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C-&amp;gt;setElem(bp-&amp;gt;row,bp-&amp;gt;col,value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bp=bp-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bpr=bpr-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return C;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix *sparseMult(sparseMatrix &amp;amp;A,sparseMatrix &amp;amp;B){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseMatrix *C=new&amp;nbsp; sparseMatrix(A.m,A.n);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *ar=A.head_row;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(ar){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *r=ar-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *bc=B.head_col;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(bc){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //bc=bc-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sparseElem *c=bc-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double value=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(c &amp;amp;&amp;amp; r &amp;amp;&amp;amp; c-&amp;gt;row&lt;r-&gt;col)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=c-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(r &amp;amp;&amp;amp; c &amp;amp;&amp;amp;&amp;nbsp; r-&amp;gt;col&lt;c-&gt;row)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r=r-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(r &amp;amp;&amp;amp; c){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value+=r-&amp;gt;value*c-&amp;gt;value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r=r-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c=c-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(value)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C-&amp;gt;setElem(ar-&amp;gt;row,bc-&amp;gt;col,value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bc=bc-&amp;gt;nextRow;//indexing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r=ar-&amp;gt;nextRow;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ar=ar-&amp;gt;nextCol;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return C;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;};&lt;br /&gt;int main(){&lt;br /&gt;&amp;nbsp; int m,n;&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"please enter m,n:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; cin&amp;gt;&amp;gt;m&amp;gt;&amp;gt;n;&lt;br /&gt;&amp;nbsp; sparseMatrix M(m,n);&lt;br /&gt;&amp;nbsp; sparseMatrix N(m,n);&lt;br /&gt;&amp;nbsp; double a;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"please enter two matrix:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; for(int i=0;i&lt;m;i++) ,not="" :m="" col="" is="" number="" of="" point="" row=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int j=0;j&lt;n;j++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin&amp;gt;&amp;gt;a;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; M.setElem(i,j,a);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; cout&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; for(int i=0;i&lt;m;i++) ,not="" :m="" col="" is="" number="" of="" point="" row=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int j=0;j&lt;n;j++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin&amp;gt;&amp;gt;a;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(a){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; N.setElem(i,j,a);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; sparseMatrix *C=M.sparseMult(M,N);&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"this is multiplaying two matrices:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; for(int i=0;i&lt;m;i++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int j=0;j&lt;n;j++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a=C-&amp;gt;getElem(i,j);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout&amp;lt;&lt;a href="http://draft.blogger.com/post-edit.g?blogID=1168125206956184142&amp;amp;postID=6741117858474738494"&gt;&amp;lt;&amp;lt;" ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; cout&amp;lt;&lt;endl;&amp;nbsp;&gt;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;/endl;&amp;nbsp;&gt;&lt;/a&gt;&lt;/n;j++){&gt;&lt;/m;i++){&gt;&lt;/endl;&gt;&lt;/n;j++){&gt;&lt;/m;i++)&gt;&lt;/endl;&gt;&lt;/n;j++){&gt;&lt;/m;i++)&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/c-&gt;&lt;/r-&gt;&lt;/tmp-&gt;&lt;/tmp-&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/n;i++)&gt;&lt;/m;i++)&gt;&lt;/n;i++)&gt;&lt;/m;i++)&gt;&lt;br /&gt;&lt;a href="http://draft.blogger.com/post-edit.g?blogID=1168125206956184142&amp;amp;postID=6741117858474738494"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://draft.blogger.com/post-edit.g?blogID=1168125206956184142&amp;amp;postID=6741117858474738494"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://draft.blogger.com/post-edit.g?blogID=1168125206956184142&amp;amp;postID=6741117858474738494"&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://draft.blogger.com/post-edit.g?blogID=1168125206956184142&amp;amp;postID=6741117858474738494"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6741117858474738494?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6741117858474738494/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/sparse-matrix.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6741117858474738494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6741117858474738494'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/sparse-matrix.html' title='Sparse Matrix'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-7082272211974663140</id><published>2010-11-07T11:06:00.000-08:00</published><updated>2010-11-07T11:06:44.333-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sorting class'/><category scheme='http://www.blogger.com/atom/ns#' term='heap'/><title type='text'>Heap sorting Class</title><content type='html'>&lt;span style="font-size: x-large;"&gt;&lt;span style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Heap Sorting class&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;template&lt;class n="" t,int=""&gt; T&amp;amp;&amp;nbsp; PQueue&lt;t,n&gt;::min(){&lt;br /&gt;&amp;nbsp; return heap[0];&lt;br /&gt;}&lt;br /&gt;template &lt;class n="" t,int=""&gt;T&amp;amp; PQueue &lt;t,n&gt;::extractMin(){&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"12"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(!heapsize)throw runtime_error(" the priority queue is empty\n");&lt;br /&gt;&amp;nbsp; T *min=new T;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"13"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; min[0]=heap[0];&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"14"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"heapsize:"&amp;lt;&lt;heapsize&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; swap(heap[0],heap[--heapsize]);//heap[0]=heap[heapsize--];&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"15"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; minHeapify(0);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"16"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; return min[0];&lt;br /&gt;}&amp;nbsp; &lt;br /&gt;template&lt;class n="" t,int=""&gt;void PQueue&lt;t,n&gt;::minHeapify(int i){&lt;br /&gt;&amp;nbsp; int l=i*2+1;//important indexing from zero&lt;br /&gt;&amp;nbsp; int r=(i+1)*2;//important indexing from zero&lt;br /&gt;&amp;nbsp; int lowest;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"17"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(l&lt;heapsize &amp;amp;&amp;amp;="" heap[i]=""&gt;heap[l]){lowest=l;}&lt;br /&gt;&amp;nbsp; else {lowest=i;}&lt;br /&gt;&amp;nbsp; if(r&lt;heapsize &amp;amp;&amp;amp;="" heap[lowest]=""&gt;heap[r]){lowest=r;}&lt;br /&gt;&amp;nbsp; if(lowest!=i){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"21 lowest="&amp;lt;&lt;lowest&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;heap[lowest]&gt;&amp;lt;&amp;lt;" heap["&amp;lt;&lt;i&gt;&amp;lt;&amp;lt;"]="&amp;lt;&lt;heap[i]&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl&gt;&amp;lt;&lt;endl&gt;&amp;lt;&amp;lt;"before tree is:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //print();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; swap(heap[lowest],heap[i]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"after swap:"&amp;lt;&lt;heap[lowest]&gt;&amp;lt;&amp;lt;" heap["&amp;lt;&lt;i&gt;&amp;lt;&amp;lt;"]="&amp;lt;&lt;heap[i]&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl&gt;&amp;lt;&lt;endl&gt;&amp;lt;&amp;lt;"after tree is:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //print();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"22"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; minHeapify(lowest);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"23"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;template &lt;class n="" t,int=""&gt; void PQueue&lt;t,n&gt;::swap(T &amp;amp;p,T &amp;amp;q){&lt;br /&gt;&amp;nbsp; T tmp=p;//code_h tmp&lt;br /&gt;&amp;nbsp; p=q;&lt;br /&gt;&amp;nbsp; q=tmp;&lt;br /&gt;}&lt;br /&gt;template&lt;class n="" t,int=""&gt; void PQueue&lt;t,n&gt;::Delete(int e){&lt;br /&gt;&amp;nbsp; if(!heapsize)throw runtime_error(" the priority queue is empty\n");&lt;br /&gt;&amp;nbsp; T *min=new T;&lt;br /&gt;&amp;nbsp; swap(heap[e],heap[--heapsize]);//if indexing from 1 for heapsize then:heap[0]=heap[heapsize--];&lt;br /&gt;&amp;nbsp; minHeapify(e);&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::increaseKey(int e){&lt;br /&gt;&amp;nbsp; heap[e]++;&lt;br /&gt;&amp;nbsp; minHeapify(e);&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::decreaseKey(int e){&lt;br /&gt;&amp;nbsp; heap[e]--;&lt;br /&gt;&amp;nbsp; minHeapify(e);&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::insert(T &amp;amp;e){&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"43"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(heapsize&amp;gt;=n) throw runtime_error("invalid address :you are inserting more than n(size)\n");&lt;br /&gt;&amp;nbsp; heap[heapsize]=e;//heapsize begin from 0&lt;br /&gt;&amp;nbsp; buildheap(heapsize++);&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::insert(T *e){&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"53"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(heapsize&amp;gt;=n) throw runtime_error("invalid address :you are inserting more than n(size)\n");&lt;br /&gt;&amp;nbsp; heap[heapsize]=*e;//heapsize begin from 0&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"60"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; buildheap(heapsize++);&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::buildheap(int h){&lt;br /&gt;&amp;nbsp; while(h&amp;gt;0 &amp;amp;&amp;amp; heap[h]&lt;heap[(h-1) -="" 2]){="" :leftchild="2i+1" from="" indexing="" k="2s+1" rightchild="2i+2" so="" when="" zero=""&gt; s=(k-1)/2&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; swap(heap[(h-1)/2],heap[h]);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; h=(h-1)/2;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;bool PQueue&lt;t,n&gt;::empty() const{&lt;br /&gt;&amp;nbsp; return heap==heap+heapsize;&lt;br /&gt;}&lt;br /&gt;template&lt;class ,int="" n="" t=""&gt;void PQueue&lt;t,n&gt;::print() const{&lt;br /&gt;&amp;nbsp; int i=0;&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"the elements in the PriorityQueue:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; while(i&lt;heapsize){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout&amp;lt;&lt;heap[i]&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;/endl;&gt;&lt;/heap[i]&gt;&lt;/heapsize){&gt;&lt;/endl;&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/heap[(h-1)&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/endl;&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl&gt;&lt;/endl&gt;&lt;/endl;&gt;&lt;/heap[i]&gt;&lt;/i&gt;&lt;/heap[lowest]&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl&gt;&lt;/endl&gt;&lt;/endl;&gt;&lt;/heap[i]&gt;&lt;/i&gt;&lt;/heap[lowest]&gt;&lt;/endl;&gt;&lt;/lowest&gt;&lt;/heapsize&gt;&lt;/heapsize&gt;&lt;/endl;&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/heapsize&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;/t,n&gt;&lt;/class&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-7082272211974663140?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/7082272211974663140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/heap-sorting-class.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7082272211974663140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7082272211974663140'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/heap-sorting-class.html' title='Heap sorting Class'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-7849899497060853173</id><published>2010-11-04T13:05:00.000-07:00</published><updated>2010-11-04T13:10:16.907-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='encoding'/><category scheme='http://www.blogger.com/atom/ns#' term='template'/><category scheme='http://www.blogger.com/atom/ns#' term='Huffman'/><category scheme='http://www.blogger.com/atom/ns#' term='pause'/><category scheme='http://www.blogger.com/atom/ns#' term='decoding'/><title type='text'>Huffman encoding and decoding using template</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;Huffman encoding&amp;nbsp; and decoding&amp;nbsp;&amp;nbsp; &lt;/b&gt;&lt;b&gt;&lt;span style="font-family: &amp;quot;Helvetica Neue&amp;quot;,Arial,Helvetica,sans-serif;"&gt;using template&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;This Hufffman using encoding&amp;nbsp; and decoding&amp;nbsp; of characters through iterating&amp;nbsp;&amp;nbsp; within a&amp;nbsp; file of text&lt;br /&gt;&lt;br /&gt;//in the name of allah&lt;br /&gt;#include&lt;iostream&gt;&lt;br /&gt;#include&lt;fstream&gt;&lt;br /&gt;#include&lt;iterator&gt;&lt;br /&gt;#include"code_char.h"&lt;br /&gt;#include"heap_class.h"&lt;br /&gt;#include"heap.h"&lt;br /&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&amp;nbsp; int paus;&lt;br /&gt;bool read_file(char* en_words,int *number,list&lt;code_ch&gt; *w){//this template must be used when we add to heap ,PQueue&lt;char *ar,int="" n=""&gt;* heap(int * a)=0,int * number=0){&lt;br /&gt;&amp;nbsp; fstream file;&lt;br /&gt;&amp;nbsp; file.open(en_words,ios::in);&lt;br /&gt;&amp;nbsp; if(!file)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;&lt;br /&gt;&amp;nbsp; //code_ch *w=new code_ch[200];&lt;br /&gt;&amp;nbsp; file.seekg(0,ios::end);&lt;br /&gt;&amp;nbsp; int end=file.tellg();&lt;br /&gt;&amp;nbsp; file.seekg(0,ios::beg);&lt;br /&gt;&amp;nbsp; int i=0;&lt;br /&gt;&amp;nbsp; char ch;&lt;br /&gt;&amp;nbsp; while(i&lt;end){ while(!file.eof()){=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.seekg(i,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.read((char*)&amp;amp;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if(ch=='\n' ||&amp;nbsp; ch=='\13')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //continue;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(ch=='\13')&lt;br /&gt;// &amp;nbsp;&amp;nbsp;&amp;nbsp; continue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!number[ch]){//if is not yet inserted to list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code_ch *tmp=new code_ch;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number[ch]++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;ch=ch;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp-&amp;gt;number=number[ch];//later we update this&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; w-&amp;gt;push_back(*tmp);//w-&amp;gt;push_front(tmp);///&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; number[ch]++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; //updateing the numbers&lt;br /&gt;&amp;nbsp; list&lt;code_ch&gt;::iterator p=w-&amp;gt;begin();&lt;br /&gt;&amp;nbsp; while(p!=w-&amp;gt;end()){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///point&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p-&amp;gt;number=number[p-&amp;gt;ch];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; //copy(w-&amp;gt;begin(),w-&amp;gt;end(),ostream_iterator&lt;code_ch&gt;(cout,""));&lt;br /&gt;&amp;nbsp; return true;&lt;br /&gt;}&lt;br /&gt;code_ch * huffman(PQueue&lt;code_ch,200&gt; &amp;amp;p,int n){&lt;br /&gt;&amp;nbsp; code_ch *x;//=new code_ch;&lt;br /&gt;&amp;nbsp; code_ch *y;//=new code_ch;&lt;br /&gt;&amp;nbsp; for(int i=1;i&lt;n;i++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; code_ch *z=new code_ch;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z-&amp;gt;left=x=&amp;amp;p.extractMin();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z-&amp;gt;right=y=&amp;amp;p.extractMin();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; z-&amp;gt;number=x-&amp;gt;number+y-&amp;gt;number;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p.insert(z);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; return &amp;amp;p.extractMin();&lt;br /&gt;}&lt;br /&gt;//this function finds the code of eeach element in the huffman tree that i create.&lt;br /&gt;void find_code(code_ch *h,int i=-1){///h is root&lt;br /&gt;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; if(h-&amp;gt;left!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int k=0;k&lt;i;k++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(h-&amp;gt;code[0][k])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;left-&amp;gt;code[0][k]=true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;left-&amp;gt;code[0][k]=false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;left-&amp;gt;code[0][i]=false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;left-&amp;gt;code_length=h-&amp;gt;code_length+1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; find_code(h-&amp;gt;left,i);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; if(h-&amp;gt;right!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int k=0;k&lt;i;k++){&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(h-&amp;gt;code[0][k])&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;right-&amp;gt;code[0][k]=true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;right-&amp;gt;code[0][k]=false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;right-&amp;gt;code[0][i]=true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; h-&amp;gt;right-&amp;gt;code_length=h-&amp;gt;code_length+1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; find_code(h-&amp;gt;right,i);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;//this function "mirizad" tree in &amp;nbsp;&amp;nbsp;&amp;nbsp; an array for useing when encodeing from file for each character we can find the element in the tree easily.&lt;br /&gt;code_ch ** inar(code_ch *root){//,int tree_size){&lt;br /&gt;&amp;nbsp; static code_ch **l=new code_ch*[200];//l[197] points to an element in the tree that its character is 'a'&lt;br /&gt;&amp;nbsp; l[root-&amp;gt;ch]=root;&lt;br /&gt;&amp;nbsp; if(root-&amp;gt;left!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inar(root-&amp;gt;left);//,tree_size);&lt;br /&gt;&amp;nbsp; if(root-&amp;gt;right!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inar(root-&amp;gt;right);//,tree_size);&lt;br /&gt;&amp;nbsp; return l;&lt;br /&gt;}&lt;br /&gt;int get_size(code_ch *root){//returns number of bits&lt;br /&gt;&amp;nbsp;&amp;nbsp; static int size=0;&lt;br /&gt;&amp;nbsp;&amp;nbsp; if(root-&amp;gt;left!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get_size(root-&amp;gt;left);&lt;br /&gt;&amp;nbsp;&amp;nbsp; if(root-&amp;gt;right!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get_size(root-&amp;gt;right);&lt;br /&gt;&amp;nbsp;&amp;nbsp; if(!root-&amp;gt;left || !root-&amp;gt;right)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; size+=root-&amp;gt;number*root-&amp;gt;code_length;&lt;br /&gt;&amp;nbsp;&amp;nbsp; return size;//this is number of bits&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;void encodeing(code_ch *root,char * en_file,code_ch **Arcode,int size){&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"coming in incodeing"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; fstream rfile,wfile;&lt;br /&gt;&amp;nbsp; rfile.open(en_file,ios::in);&lt;br /&gt;&amp;nbsp; wfile.open("encoded.txt",ios::out);&lt;br /&gt;&amp;nbsp; if(!rfile || !wfile)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw runtime_error("cannot open the files...\n");&lt;br /&gt;&amp;nbsp; rfile.seekg(0,ios::end);&lt;br /&gt;&amp;nbsp; int end=rfile.tellg();&lt;br /&gt;&amp;nbsp; rfile.seekg(0,ios::beg);&lt;br /&gt;&amp;nbsp; int i=0,seek=0,j=0;&lt;br /&gt;&amp;nbsp; char ch;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"declaring A"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; bitArray A(size);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"this is size="&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"after"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; while(i&lt;end){ while(!file.eof()){=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rfile.seekg(i,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rfile.read((char*)&amp;amp;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;ch&gt;&amp;lt;&amp;lt;" ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;" "&amp;lt;&lt;ch;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(j=0;j&lt;arcode[ch]-&gt;code_length;j++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"&amp;nbsp; j="&amp;lt;&lt;j;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(Arcode[ch]-&amp;gt;code[0][j]){//if true&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;" "&amp;lt;&amp;lt;1&amp;lt;&amp;lt;" ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A[j+seek]=true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;" 0 ";;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A[j+seek]=false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; seek+=j;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl&gt;&amp;lt;&amp;lt;"seek is:"&amp;lt;&lt;seek&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; i=0;&lt;br /&gt;&amp;nbsp; while(i&amp;lt;=size/8+1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ch=(char)A.a[i];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.seekp(i,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.write(&amp;amp;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; //wfile.write((char*)&amp;amp;A.a,size/8+1);&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ///point&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"in file:"&amp;lt;&lt;wfile.tellp()&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; wfile.close();&lt;br /&gt;&amp;nbsp; rfile.close();&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"file closed"&amp;lt;&lt;endl;&gt;&lt;br /&gt;}&lt;br /&gt;void inorderWalk(code_ch *root){&lt;br /&gt;&amp;nbsp; if(root-&amp;gt;left!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inorderWalk(root-&amp;gt;left);&lt;br /&gt;&amp;nbsp; cout&amp;lt;&lt;root-&gt;ch&amp;lt;&amp;lt;"&amp;nbsp; "&amp;lt;&lt;root-&gt;number&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(root-&amp;gt;right!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; inorderWalk(root-&amp;gt;right);&lt;br /&gt;}&lt;br /&gt;void decoding(code_ch *root,int size){//very simple only read from file and if 0 go to left else go to right&lt;br /&gt;//cout&amp;lt;&amp;lt;"coming into decodig"&amp;lt;&lt;endl;&gt;&lt;br /&gt;//cout&amp;lt;&amp;lt;"--------------------------------------------------size="&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; code_ch *p=root;&lt;br /&gt;&amp;nbsp; fstream rfile,wfile;&lt;br /&gt;&amp;nbsp; rfile.open("encoded.txt",ios::in);&lt;br /&gt;&amp;nbsp; wfile.open("decoded.txt",ios::out);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"after openning the files"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; if(!rfile || !wfile)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw runtime_error("cannot open the files...\n");&lt;br /&gt;&amp;nbsp; rfile.seekg(0,ios::end);&lt;br /&gt;&amp;nbsp; int end=rfile.tellg();&lt;br /&gt;&amp;nbsp; rfile.seekg(0,ios::beg);&lt;br /&gt;&amp;nbsp; int i=0,j=0;&lt;br /&gt;&amp;nbsp; char ch;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"before declaring A"&amp;lt;&lt;endl;&amp;nbsp;&amp;nbsp;&amp;nbsp;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"--------------------------------------------------size="&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; bitArray A(size);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"--------------------------------------------------size="&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;5&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"root hehhhhhhhhhhhhhere :"&amp;lt;&lt;root-&gt;left-&amp;gt;number&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"--------------------------------------------------size="&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; i=0;&lt;br /&gt;&amp;nbsp; while(i&amp;lt;=size/8+1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rfile.seekg(i,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rfile.read(&amp;amp;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A.a[i]=(unsigned char)ch;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; rfile.seekg(0,ios::beg);&lt;br /&gt;&amp;nbsp; i=0;&lt;br /&gt;&amp;nbsp; while(i&amp;lt;=size){//while(!file.eof()){&lt;br /&gt;&amp;nbsp;//cout&amp;lt;&amp;lt;"in while"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(A[i]){//if it is true go to right&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(p-&amp;gt;right!=NULL)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p=p-&amp;gt;right;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.seekp(j,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.write((char*)&amp;amp;p-&amp;gt;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; j++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p=root;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue;///point&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"--------------before else"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;0;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(p-&amp;gt;left!=NULL){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"in if of else"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p=p-&amp;gt;left;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //cout&amp;lt;&amp;lt;"in else of it"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.seekp(j,ios::beg);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; wfile.write((char*)&amp;amp;p-&amp;gt;ch,1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; j++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; p=root;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue;///point&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i++;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;// cout&amp;lt;&amp;lt;9&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; rfile.close();&lt;br /&gt;&amp;nbsp; wfile.close();&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;10&amp;lt;&lt;endl;&gt;&lt;br /&gt;}&lt;br /&gt;int main(int argc,char **argv){&lt;br /&gt;&amp;nbsp; if(argc==1){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout&amp;lt;&amp;lt;"you haven't entered a file!&amp;nbsp; exiting..."&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; list&lt;code_ch&gt;w;&lt;br /&gt;&amp;nbsp; int *a=new int [200];//for saving the number of each ch&lt;br /&gt;&amp;nbsp; for(int i=0;i&amp;lt;200;i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a[i]=0;&lt;br /&gt;&amp;nbsp; bool is_read=read_file(argv[1],a,&amp;amp;w);&lt;br /&gt;&amp;nbsp; if(!is_read)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw runtime_error("cannot open the file you entered...\n");&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"and the heap"&amp;lt;&lt;endl&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; PQueue&lt;code_ch,200&gt; p(w);&lt;br /&gt;&amp;nbsp; code_ch *root=huffman(p,w.size());&lt;br /&gt;&amp;nbsp; find_code(root);&lt;br /&gt;&amp;nbsp; int size=get_size(root);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"this is size in the main:"&amp;lt;&lt;size&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; code_ch ** Arcode=inar(root);//,int tree_size);&lt;br /&gt;&amp;nbsp; char *coded;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;"first puase:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cin&amp;gt;&amp;gt;paus;&lt;br /&gt;&amp;nbsp; int paus1;&lt;br /&gt;&amp;nbsp; encodeing(root,argv[1],Arcode,size);//encodeing(root,argv[1],Arcode,size);&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&amp;lt;" puase2:"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cin&amp;gt;&amp;gt;paus;&lt;br /&gt;&amp;nbsp; decoding(root,size);&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"tamam"&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //cout&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/code_ch,200&gt;&lt;/endl;&gt;&lt;/endl&gt;&lt;/code_ch&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/endl;&gt;&lt;/root-&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/endl;&amp;nbsp;&amp;nbsp;&amp;nbsp;&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/root-&gt;&lt;/root-&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/wfile.tellp()&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/seek&gt;&lt;/endl&gt;&lt;/j;&gt;&lt;/arcode[ch]-&gt;&lt;/ch;&gt;&lt;/ch&gt;&lt;/end){&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/size&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/i;k++){&gt;&lt;/i;k++){&gt;&lt;/n;i++){&gt;&lt;/code_ch,200&gt;&lt;/code_ch&gt;&lt;/code_ch&gt;&lt;/end){&gt;&lt;/char&gt;&lt;/code_ch&gt;&lt;/iterator&gt;&lt;/fstream&gt;&lt;/iostream&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-7849899497060853173?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/7849899497060853173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/huffman-encoding-and-decoding-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7849899497060853173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7849899497060853173'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2010/11/huffman-encoding-and-decoding-using.html' title='Huffman encoding and decoding using template'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-2985894404088973098</id><published>2010-10-23T02:10:00.000-07:00</published><updated>2010-10-23T02:10:48.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='call'/><category scheme='http://www.blogger.com/atom/ns#' term='method'/><category scheme='http://www.blogger.com/atom/ns#' term='chaining'/><title type='text'>method call chaining   cpp</title><content type='html'>//in the name of Allah&lt;br /&gt;#include&lt;iostream&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;class A{&lt;br /&gt;&amp;nbsp; public:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int a,b,c;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A seta(){a=1;cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setb(){b=2;cout&amp;lt;&amp;lt;"in b"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *seta(){a=1;cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *setb(){b=2;cout&amp;lt;&amp;lt;"in b"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void seta1(){cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&amp;nbsp; setb1(){cout&amp;lt;&amp;lt;"in b1"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&amp;nbsp; setc1(){cout&amp;lt;&amp;lt;"in c1"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp; seta2(){cout&amp;lt;&amp;lt;"in a2"&amp;lt;&lt;endl;return 0;;};=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp; setb2(){cout&amp;lt;&amp;lt;"in b2"&amp;lt;&lt;endl;return 0;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int setc2(){cout&amp;lt;&amp;lt;"in c2"&amp;lt;&lt;endl;return 0;};=""&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A seta3(){a=0;cout&amp;lt;&amp;lt;"in a3"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setb3(){b=-1;cout&amp;lt;&amp;lt;"in b3"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc3(){c=-2;cout&amp;lt;&amp;lt;"in c3"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;};&lt;br /&gt;int main(){&lt;br /&gt;&amp;nbsp; A a;&lt;br /&gt;&amp;nbsp; a.seta()-&amp;gt;setb()-&amp;gt;setc();//a.seta().setb().setc();&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"=======================checkin&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; zzg===================="&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"a="&amp;lt;&lt;a.a&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; b="&amp;lt;&lt;a.b&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c= "&amp;lt;&lt;a.c&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; //a.seta().setb1().setc1();//invalid use of void&lt;br /&gt;&amp;nbsp; //a.seta2().setb2().setc2();//:24: error: request for member ‘setb2’ in ‘a.A::seta2()’, which is of non-class type ‘int&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.seta3().setb3().setc3();&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"=======================checking3===================="&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; cout&amp;lt;&amp;lt;"a="&amp;lt;&lt;a.a&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; b="&amp;lt;&lt;a.b&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c= "&amp;lt;&lt;a.c&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// //in the name of Allah&lt;br /&gt;// #include&lt;iostream&gt;&lt;br /&gt;// using namespace std;&lt;br /&gt;// class A{&lt;br /&gt;//&amp;nbsp;&amp;nbsp; public:&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int a,b,c;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A(){&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A seta(){a=1;cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setb(){b=2;cout&amp;lt;&amp;lt;"in b"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;// // //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;return *this;};=""&gt;&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *seta(){a=1;cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *setb(){b=2;cout&amp;lt;&amp;lt;"in b"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;// //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A *setc(){c=3;cout&amp;lt;&amp;lt;"in c"&amp;lt;&lt;endl;return this;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void seta(){cout&amp;lt;&amp;lt;"in a"&amp;lt;&lt;endl;;};&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&amp;nbsp; setb1(){cout&amp;lt;&amp;lt;"in b1"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void&amp;nbsp; setc1(){cout&amp;lt;&amp;lt;"in c1"&amp;lt;&lt;endl;};&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp; seta2(){cout&amp;lt;&amp;lt;"in a2"&amp;lt;&lt;endl;return 0;;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp; setb2(){cout&amp;lt;&amp;lt;"in b2"&amp;lt;&lt;endl;return 0;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int setc2(){cout&amp;lt;&amp;lt;"in c2"&amp;lt;&lt;endl;return 0;};=""&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;// };&lt;br /&gt;// int main(){&lt;br /&gt;//&amp;nbsp;&amp;nbsp; A a;&lt;br /&gt;//&amp;nbsp;&amp;nbsp; a.seta()-&amp;gt;setb()-&amp;gt;setc();//a.seta().setb().setc();&lt;br /&gt;//&amp;nbsp;&amp;nbsp; cout&amp;lt;&amp;lt;"=======================checking===================="&amp;lt;&lt;endl;&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp; cout&amp;lt;&amp;lt;"a="&amp;lt;&lt;a.a&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; b="&amp;lt;&lt;a.b&gt;&amp;lt;&amp;lt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c= "&amp;lt;&lt;a.c&gt;&amp;lt;&lt;endl;&gt;&lt;br /&gt;//&amp;nbsp;&amp;nbsp; //a.seta().setb1().setc1();//invalid use of void&lt;br /&gt;//&amp;nbsp;&amp;nbsp; //a.seta2().setb2().setc2();//:24: error: request for member ‘setb2’ in ‘a.A::seta2()’, which is of non-class type ‘int&lt;br /&gt;//&amp;nbsp;&amp;nbsp; &lt;br /&gt;// }&lt;/endl;&gt;&lt;/a.c&gt;&lt;/a.b&gt;&lt;/a.a&gt;&lt;/endl;&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;};&gt;&lt;/endl;;};&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/iostream&gt;&lt;/endl;&gt;&lt;/a.c&gt;&lt;/a.b&gt;&lt;/a.a&gt;&lt;/endl;&gt;&lt;/endl;&gt;&lt;/a.c&gt;&lt;/a.b&gt;&lt;/a.a&gt;&lt;/endl;&gt;&lt;/endl;};&gt;&lt;/endl;};&gt;&lt;/endl;};&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;};&gt;&lt;/endl;;};&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/endl;};&gt;&lt;/endl;return&gt;&lt;/endl;return&gt;&lt;/iostream&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-2985894404088973098?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/2985894404088973098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2010/10/method-call-chaining-cpp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2985894404088973098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2985894404088973098'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2010/10/method-call-chaining-cpp.html' title='method call chaining   cpp'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-8264532916260261246</id><published>2010-05-28T09:51:00.000-07:00</published><updated>2010-05-28T09:55:15.984-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='program'/><category scheme='http://www.blogger.com/atom/ns#' term='sudoku'/><category scheme='http://www.blogger.com/atom/ns#' term='exe'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>c sudoku program exe</title><content type='html'>&lt;span style="font-size: large;"&gt;&lt;b&gt;c sudoku program exe&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;algorithm&gt;&lt;br /&gt;#include &lt;string&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;const int M = 9 + 10;&lt;br /&gt;int a[M][M], t[M];&lt;br /&gt;&lt;br /&gt;void err (char c, int n) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;string s = "soooooooooooooooti";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'c')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "soton ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'r')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "satr ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 's')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "morabaa ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; n &amp;lt;&amp;lt; " eshkal dare\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;exit (0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; a[i][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//satr&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof(t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err ('r', i);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//soton&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err ('c', j);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char c;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; "mikhay morabaha ro ham bebinam? (y/n)\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; c;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'y') {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int x=1; x&amp;lt;10; x += 3)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int y=1; y&amp;lt;10; y +=3) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=x; i &amp;lt; x+3; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=y; j &amp;lt; y+3; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err('s', x*10 + y);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;br /&gt;}&lt;/string&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Algorithm &lt;br /&gt;&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;algorithm&gt;&lt;br /&gt;#include &lt;string&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;const int M = 9 + 10;&lt;br /&gt;int a[M][M], t[M];&lt;br /&gt;&lt;br /&gt;void err (char c, int n) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string s = "soooooooooooooooti";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (c == 'c')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s = "soton ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (c == 'r')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s = "satr ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (c == 's')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s = "morabaa ";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; n &amp;lt;&amp;lt; " eshkal dare\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exit (0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=1; i&amp;lt;10; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j=1; j&amp;lt;10; j++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; cin &amp;gt;&amp;gt; a[i][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //satr&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; memset (t, 0, sizeof(t));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j=1; j&amp;lt;10; j++){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; err ('r', i);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //soton&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j=1; j&amp;lt;10; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; err ('c', j);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char c;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; "mikhay morabaha ro ham bebinam? (y/n)\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cin &amp;gt;&amp;gt; c;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (c == 'y') {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int x=1; x&amp;lt;10; x += 3)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int y=1; y&amp;lt;10; y +=3) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=x; i &amp;lt; x+3; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; for (int j=y; j &amp;lt; y+3; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; err('s', x*10 + y);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/string&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;br /&gt;&lt;iostream&gt;&lt;algorithm&gt;&lt;string&gt;&lt;/string&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;br /&gt;&lt;iostream&gt;&lt;algorithm&gt;&lt;string&gt;&lt;br /&gt;} &lt;/string&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;br /&gt;&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;algorithm&gt;&lt;br /&gt;#include &lt;string&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;const int M = 9 + 10;&lt;br /&gt;int a[M][M], t[M];&lt;br /&gt;&lt;br /&gt;void err (char c, int n) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;string s = "soooooooooooooooti";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'c')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "soton ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'r')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "satr ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 's')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;s = "morabaa ";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; s &amp;lt;&amp;lt; n &amp;lt;&amp;lt; " eshkal dare\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;exit (0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int main () {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; a[i][j];&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//satr&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof(t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++){&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err ('r', i);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//soton&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=1; j&amp;lt;10; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=1; i&amp;lt;10; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err ('c', j);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;char c;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cout &amp;lt;&amp;lt; "mikhay morabaha ro ham bebinam? (y/n)\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cin &amp;gt;&amp;gt; c;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (c == 'y') {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int x=1; x&amp;lt;10; x += 3)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int y=1; y&amp;lt;10; y +=3) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;memset (t, 0, sizeof (t));&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int i=x; i &amp;lt; x+3; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (int j=y; j &amp;lt; y+3; j++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (t[ a[i][j] ] == 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;err('s', x*10 + y);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;t[ a[i][j] ] = 1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To&amp;nbsp; download&amp;nbsp;&amp;nbsp; the exe file code&lt;br /&gt;&lt;br /&gt;Click&amp;nbsp;&lt;span style="font-size: x-large;"&gt;&lt;b&gt; &lt;a href="http://www.4shared.com/file/2Zbc1zbz/sudoku_program.html"&gt;Downloads&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;IF you have comments or ideas leave them below &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/string&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-8264532916260261246?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/8264532916260261246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2010/05/c-sudoku-program-exe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8264532916260261246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8264532916260261246'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2010/05/c-sudoku-program-exe.html' title='c sudoku program exe'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-3193080865210971143</id><published>2009-09-17T12:04:00.000-07:00</published><updated>2009-09-17T12:30:30.983-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='methods'/><category scheme='http://www.blogger.com/atom/ns#' term='CPU'/><category scheme='http://www.blogger.com/atom/ns#' term='cooling'/><category scheme='http://www.blogger.com/atom/ns#' term='sink'/><title type='text'>CPU Cooling  methods</title><content type='html'>&lt;div style="text-align: center; font-weight: bold;"&gt;&lt;span style="font-size:180%;"&gt;CPU cooling methods&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;The massive activity that goes on inside your PC generates extensive heat., sometimes known to reach 185 degrees F.   The reasons for your PC heating up are&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    Insulation caused by dust – dust filters can be provided and other persistent  dust can be vacuumed out&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    Scant or erratic airflow – can be modulated for even spread&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Optimally the CPU has to be maintained around a temperature of 70 degrees F. A CPU coolant does just that. In its absence, overheat leads into myriad problems culminating in frequent crash-downs, computer freezing and in curtailing the life-span of the computer.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;A passive heat sink is the basic type of CPU cooler.  It draws heat away from the processor, which is dissipated over a large metallic (aluminum is commonly used) surface area.  When a fan, atop the sink, or below it, exchanges the heat from the chip, for cooler air, this becomes an active heat sink  When suitable computer parts are throttled  to bring down the heat it is called soft cooling.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;The sink is attached to the processor using spring or screw devices or a thermal interface material that adheres the processor to the heat sink. The interface material should be used in computers, for  which mounting the sink on screws or springs is not possible.  An inappropriate application of thermal compound can lead to inadequate heat transfer.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A good heat sink  characteristics&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;•  &lt;span style="font-family: trebuchet ms;"&gt;  Fans (about 12 volts power and 2X120 mm dimension) have to be designed optimally to dissipate the right amount of heat &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    The right surface area for heat transfer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    Designed for maximum thermal transfer – a factor dependent on the material of the sink and the thickness of the fins (Thick fins – good conductivity, fine fins – better dissipation)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    A combination of optimal area and the fins spaced at the right distance should be sought&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    Flat surface at the heat source ensures an even, thin application of interface material, for better cooling&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    At the surface of contact the level of adherence must be high, to provide good pressure&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;The performance of the sink is measured in C/W or K/W (thermal resistance), not in the regular temperature scales like Centigrade or Kelvin, as difference in temperature is the required parameter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;For instance of a load of 30W is applied and the temperature rises by 15 degrees C then the performance is rated as  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;15C/30 W  = ½ C/W. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;However you cannot use this parameter as one of the criteria for purchase of your computer, because the thermal resistance displayed on the product may be inaccurate or exaggerated, as a marketing strategy.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: courier new;"&gt;Liquid cooling&lt;/span&gt;&lt;br /&gt;This consists of a combination of &lt;br /&gt;•    a system of pipes with liquid, that run inside the cooling system to extract heat from the processor and cool it&lt;br /&gt;•    a pump for liquid circulation. a cooling block to wring out the heat from the microprocessor&lt;br /&gt;•    a optional  radiator with a condenser coil to decrease the temperature of water and  send out the hear from the CPU onto the cooling arrangement&lt;br /&gt;PCs with this set up do not need fans whereas a Cray 2  will need radiators to complete the set up.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The liquid must &lt;/span&gt;&lt;br /&gt;•   &lt;span style="font-family: trebuchet ms;"&gt; exhibit a lower level of thermal conductivity&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    have a certain extent of dielectric nature&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;Generally the liquids used are motor oils,  various other oils including cooking oil,  and Flour inert, (a special cooling oil manufactured by the 3M Company) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;Water is used significantly in computers set for overclocking.  Liquid nitrogen (or sometimes dry ice) cooling can generate a high efficiency rate in computer working. This uses water as the medium to cool/condense… However nitrogen is used only in highly overclocked situations as it needs to be refilled.  Besides, the system may succumb to the temperature deviations created, created within the cooling system.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; Be wary of&lt;/span&gt;&lt;br /&gt;•    &lt;span style="font-family: trebuchet ms;"&gt;Heated liquid- This problem is taken care of by fans, usually low-noise ones, to cool the liquid which are set up outside the portable computer’s case.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    Evaporation –When the overheated liquid eventually evaporates, resort to sealing the medium within the computer  or refill the liquid whenever needed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;•    Seepage- For leak problems, disconnect the computer from the power source, mop the seepage with an absorbing cleaning material , identify the source of leakage and replace it… Avoid skin contact with coolant, as it may cause irritation.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The other cooling  options  and methods  are&lt;br /&gt;•&lt;span style="font-family: verdana;"&gt;    Peltier cooling  creates a temperature difference using Bismuth-telleride thermocouples, stacked in hundreds on the principle of Seebeck effect&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    HVAC systems in large Data Centers&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    Phase Change cooling in PCs, situated under it with pipes reaching the processors&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    H2Ceramic Cooling –uses sensors to detect overheat-combining with Peltier and liquid cooling&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;span style="font-weight: bold;"&gt;Heat Sensors &lt;/span&gt;To help manage CPU cooling  the motherboard can be equipped with a smart sensor to indicate voltage, temperature of the CPU and  the fans. Smart sensors are now being equipped with features that can, on excess heating&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    set off an audio alarm&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    flash a warning message on your screen&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;•    shut down the system automatically.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For more related information  you can reach to&lt;br /&gt;http://www.heatsink-guide.com/&lt;br /&gt;http://en.wikipedia.org/wiki/CPU_cooling#Spot_Cooling&lt;br /&gt;http://www.pantherproducts.co.uk/Articles/CPU/CPU%20Cooling.shtml&lt;br /&gt;* * * * * * * * * *&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;A+ Test&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;1.  Should the fans&lt;/span&gt;&lt;br /&gt;a)blow air towards the heat sink&lt;br /&gt;b)draws air away from it&lt;br /&gt;c)change to and fro in direction&lt;br /&gt;to cool effectively&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;2. The fins on the should be &lt;/span&gt;&lt;br /&gt;a)    Fine and closely spaced&lt;br /&gt;b)    Thicker and closely spaced&lt;br /&gt;c)    Fine and widely spaced&lt;br /&gt;d)    Thick and widely spaced&lt;br /&gt;3. Cooking oil is a good option as a cooling liquid because&lt;br /&gt;       a) It is an electrical Insulator&lt;br /&gt;       b) It can dispel heat&lt;br /&gt;       c) Both the above&lt;br /&gt;       d) Neither of the above because  It has a very low melting point&lt;br /&gt;4.  Cables for airflow in a cooling unit must be&lt;br /&gt;a)    Flat ribbon cables to synchronize with the storage drive and holding  the conductive wires together tightly, to reduce surface area&lt;br /&gt;b)    Rounded cables holding  the conductive wires together tightly to reduce surface area&lt;br /&gt;c)    Neither of the above&lt;br /&gt;5. Consider these statements regarding water as the cooling liquid for your CPU&lt;br /&gt;  A. Freezing point of water used in coolants can be reduced with     additives.&lt;br /&gt;  B. Color is added to monitor flow&lt;br /&gt;  C. Anti corrosive/antimicrobial additives increases its efficiencyas a cooling medium&lt;br /&gt;a)    A,B and C are essential&lt;br /&gt;b)    A is optional&lt;br /&gt;c)    B is Optional&lt;br /&gt;d)    C is optional&lt;br /&gt;e)    All additives  are optional . water works fine without any of them  &lt;span style="font-weight: bold;"&gt;       &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-3193080865210971143?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/3193080865210971143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/09/cpu-cooling-methods.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3193080865210971143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3193080865210971143'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/09/cpu-cooling-methods.html' title='CPU Cooling  methods'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-7830471906043335</id><published>2009-09-12T13:08:00.000-07:00</published><updated>2011-09-29T11:03:30.720-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PATTERNS'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='SEQUENCES'/><category scheme='http://www.blogger.com/atom/ns#' term='NUMBER'/><title type='text'>NUMBER PATTERNS AND SEQUENCES TUTORIAL</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: center;"&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-size: 180%;"&gt;NUMBER PATTERNS AND SEQUENCES &lt;/span&gt;&lt;span style="font-size: 180%;"&gt;TUT&lt;/span&gt;&lt;span style="font-size: 180%;"&gt;OR&lt;/span&gt;&lt;span style="font-size: 180%;"&gt;IA&lt;/span&gt;&lt;span style="font-size: 180%;"&gt;L&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;div style="font-weight: bold;"&gt;Subject            :    Mathematics Form 1&lt;/div&gt;&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;br /&gt;&lt;span style="font-family: verdana; font-size: 130%; font-weight: bold; text-decoration: underline;"&gt;&lt;span style="font-weight: normal;"&gt;and To get the document in MS word file&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;=&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif; font-size: x-large;"&gt;&lt;a href="https://docs.google.com/leaf?id=10YyUYkh7-xVxeAyEntK9Kw0HpdAbKeu1nXew4lAe4BYMp7sdwbgqafaYZoEf&amp;amp;hl=en_US"&gt;View&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="text-decoration: underline;"&gt;&lt;b&gt;To Get more&amp;nbsp;&lt;a href="http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html"&gt;&lt;span class="Apple-style-span" style="color: #e06666; font-family: Georgia, 'Times New Roman', serif; font-size: x-large;"&gt;DOWNLOAD&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif; font-size: x-large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #cc0000; font-family: 'Trebuchet MS', sans-serif; font-size: x-large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #990000; font-family: Georgia, 'Times New Roman', serif;"&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;IN  WORD DOCS&lt;br /&gt;&lt;br /&gt;&amp;nbsp;or see it on gooogle doc&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;&lt;span style="font-weight: bold;"&gt;Learning Objective    : &lt;/span&gt;   Number Patterns and Number Sequences&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;&lt;span style="font-weight: bold;"&gt;Learning Outcomes    : &lt;/span&gt;   &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    Identify patterns of number sequenc&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;es.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2.    Extend, complete and construct number sequences.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;3.    Recognize&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; odd and even numbers and explore their general properties.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;4.    Identify prime numbers.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;5.    Understand factors and prime factors.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;6.    Find the common factors and highest common factors (HCF).&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;7.    Understand multiples.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;8.    Find the common multiples and lowest comm&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;o&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;n multiples (LCM&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;2.1 Number Patterns &amp;amp;amp; Number Seque&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;nces&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;-&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; A l&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;ist of numbers that follow a certain pattern is called number sequence.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- In a n&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;umber sequence, we can see how the number pattern is form.&lt;/span&gt;  &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To see the lesson in MS word form  &lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: underline;"&gt;&lt;span style="color: #990000; font-size: 180%;"&gt;&lt;span style="font-family: 'times new roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html"&gt;&lt;span style="color: #990000; font-size: 180%;"&gt;&lt;span style="font-family: 'times new roman';"&gt;DOWNLOAD&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; hERE&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    3,  7,  11,  15,  19&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :     b&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;egin with 3 and add&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; 4 to the number before it (+4)&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    305,  300,  295,  290,  285&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :    begin with 305 then min&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;us / subtract 5 from the number before it (- 5)&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    2,  6,  18,  54,   162&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;    begin with 2, then multiply each number by 3 (x3)&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;4.    64,  32,  16,  8, 4&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :    begin with 64 then divide each number by 2 (÷ 2)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Complete the missing number in the n&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;List the number sequences for these n&lt;span style="font-weight: bold;"&gt;u&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;mber sequences&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    3,  6,   9  ,  12,  15 , 18&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :      + 3&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    64,  56,  48,  40,  32,  29 &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :    - 8 &lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    7,   21,   63,   189,   567,   1761 &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :     x 3&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;4.    800,  400,  200,  100,  50,  25 &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Pattern :     ÷  2&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;umber patterns&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    List down the whole numbers between &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;30 to 37&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;31,  32,  33,  34,  35,  36&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    Add 5 to whole numbers from 3 to 2&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;8&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;3,  8,  13,  18,  23,  28&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    Subtract 3 f&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;rom whole number from 13 to 1&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;13,  10,  7,  4,  1&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;4.    Multiply 4 to whole numbers from 2 to &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;128&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2,  8,  32,  128&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;2.2 Even Numbers &amp;amp;amp; Odd Numbers&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;- Even numbers are whole numbers t&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;h&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;at can be divided by 2 exactly (no remainder).&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;   Example:    2,  4,  6,  8,  10,  …&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- Odd numbers are whole numbers that cannot be divided by 2 exactly (has remainder).&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;   Example:    1,  3,  5,  7, &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;9,  11,  …&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- ‘0’ is neither an add number nor an even number&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Determine whether these nu&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;mbers are even numbers or odd numbers&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    214        214 ÷ 2 = 107            therefore 214 is an even nu&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;mber&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2.    735        735 ÷ 2 = 367 remainder 1        therefore 735 is an odd numb&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;e&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;r&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;3.    2 579    2 579 ÷ 2 = 1 289 remainder 1    therefore 2 579 is an odd number&lt;/span&gt; 4.    5 550    5 550 ÷ 2 = 2 775&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://3.bp.blogspot.com/_VbplSiPqRyo/SqwFT8mVhzI/AAAAAAAAAOY/hUO_Alzu6Xk/s1600-h/even+odd+relation.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380681495043475250" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SqwFT8mVhzI/AAAAAAAAAOY/hUO_Alzu6Xk/s320/even+odd+relation.JPG" style="cursor: pointer; height: 257px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://3.bp.blogspot.com/_VbplSiPqRyo/SqwFqTvLe8I/AAAAAAAAAOg/B_jG0U-R2so/s1600-h/even+conclusion.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380681879211703234" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SqwFqTvLe8I/AAAAAAAAAOg/B_jG0U-R2so/s320/even+conclusion.JPG" style="cursor: pointer; height: 154px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;2.3 Prime Numbers&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;- Prime number is a whole number that can only be divided by itself and number 1&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- The number 1 is not a prime number because it can only be divided by itself&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- All the prime numbers are odd numbers except for 2&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- Exam&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;ple &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;:    2&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;,  3,  5,  7,  11,  13,  17,  19,  23,  29,  …&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Determine whether this number is a prime number or not&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    31        31 ÷ 1 = 31    31÷ 31 = 1&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;31 can only be divide&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;d by 1 and itself. 31 is a prime number&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    65        65 ÷ 1 = 65    65 ÷ 65 = 1    65 ÷ 5 = 13&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;65 can be divided by 1, itself and also 5&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;. 65&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; is not a prime number&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    71        71 ÷ 1 = 71    71÷ 71 = 1&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;71 can only be divi&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;ded by 1 and itself. 71 is a prime number&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;4.    93        93 ÷ 1 = 93    93 ÷ 93 = 1    93 ÷ 3 = 31&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;93 can be divided by 1&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;, itself and 3. 93 is no&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;t a prime number&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Sieve Of Erastosthenes&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- A method o&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;f finding prime numbers between 1 to 100 (25 numbers)&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Step 1:    list down all whole numbers between 1 to 100&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwGs3Wb3QI/AAAAAAAAAOo/e_pKJFb1sug/s1600-h/Sieve+Of+Erastosthenes.GIF" style="font-weight: bold;"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380683022642961666" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwGs3Wb3QI/AAAAAAAAAOo/e_pKJFb1sug/s320/Sieve+Of+Erastosthenes.GIF" style="cursor: pointer; height: 225px; width: 320px;" /&gt;&lt;/a&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;Whole&amp;nbsp;numbers photo&lt;/b&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Step 2:    Cross out 1, because 1 is not a prime number.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Step 3:    Circle 2 and cross out all numbers that can divided by 2.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Step 4:    Circle 3 and cross out all numbers that can divided by 3.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Step 5:    Circle 5 and cross out all numbers that can divided by 5.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Step 6:    Circle 7 and cross out all numbers that can divided by 7.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Step 7:    Circle all remaining numbers and list down. The remaining numbers are the prime numbers between 1 to 100.&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Answer:     2,  3,  5,  7,  11,  13,  17,  19,  23,  29,  31,  37,  41,  &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;43,  47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html"&gt;http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;2.4 Factors&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;- A factor of a given number is the number that can divide the given number exactly  &lt;span style="font-weight: normal;"&gt;  without any remainder.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- The number 1 is a factor of all numbers.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- Every number is a factor of itself&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- A &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;whole number may have more than 2 factors.&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;List all the factors of these number&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;s&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    6        1&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; x 6        factors of 6 = 1,  2,  3,  6&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2 x 3&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    18        1 x 18        factors of 6 = 1,  2,  3,  6,  9,  18&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2 x 9&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;3 x 6&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    45        1 x 45        factors of 6 = 1,  3,  5,  9,  15,  45&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;3 x 15&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;5 x 9&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;4.    88        1 x 88        factors of 6 = 1,  2,  4,  8,  11,  22,  44,  88&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;2 x 44&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;4 x 22&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;8 x 11&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Determine whether&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    9 is a factor of 54        54 ÷ 9 = 6 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 9 is a f&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;actor of 54&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    7 is a factor of 4&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;8        48 ÷ 7 = 6 remainder 6  (not exact division)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 7 is not a factor of 48&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;2.5 Prime Factors&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;- Prime factors of a given number are factors which are also prime numbers.  &lt;span style="font-weight: normal;"&gt;- Example:    Factors of 6:         1, 2, 3, &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;6&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;        Prime numbers:        2 and 3&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;        Prime factors of 6:    2 and 3&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;List all the prime factors of&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; t&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;hese numbers.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    24&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Method 1 : List the factors&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 24        :    1,  2,  3,  4,  6,  8,  12,  24&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Prime Factors    :    2 and 3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwHoYLNzeI/AAAAAAAAAOw/2l_0ZIjnptg/s1600-h/Continuous+Division.GIF"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380684045066554850" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwHoYLNzeI/AAAAAAAAAOw/2l_0ZIjnptg/s320/Continuous+Division.GIF" style="cursor: pointer; height: 121px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwHt0iL3RI/AAAAAAAAAO4/NDL5jM1Zv2g/s1600-h/prime+factors.GIF"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380684138578435346" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SqwHt0iL3RI/AAAAAAAAAO4/NDL5jM1Zv2g/s320/prime+factors.GIF" style="cursor: pointer; height: 104px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Method 2  : Continuous Division&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://4.bp.blogspot.com/_VbplSiPqRyo/SqwIobi0XnI/AAAAAAAAAPA/lGwZU-W8qLU/s1600-h/Continuous+Division2.GIF"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380685145482485362" src="http://4.bp.blogspot.com/_VbplSiPqRyo/SqwIobi0XnI/AAAAAAAAAPA/lGwZU-W8qLU/s320/Continuous+Division2.GIF" style="height: 240px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #a64d79;"&gt;&lt;a href="https://docs.google.com/leaf?id=1pGgYginkioiHLrD_ba5QEEl9i3oi8PxGWT-gUjqhTHzhxMb51d9B0BaFhJpN&amp;amp;sort=name&amp;amp;layout=list&amp;amp;num=50"&gt;https://docs.google.com/exercises  &lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Determine whether&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    2 is a  prime factor of 18    18 ÷ 2 = 9 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 2 is a prime factor of 18&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    7 is a factor of 46        46 ÷ 7 = 6 remainder&lt;/span&gt;&lt;span style="font-weight: normal;"&gt; 4  (not exact division)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 7 is not a prime factor of 46&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    4 is a factor of 200        200 ÷ 4 = 50 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;4 is a factor of 200 but 4 is no&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;t a prime number&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 4 is not a prime factor of 200&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;.6 Common Factors &amp;amp;amp; Highest Common Factors (HCF)&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Common Factors&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- Common factor is a number that is a factor of two or more numbers. &lt;/span&gt; &lt;span style="font-weight: normal;"&gt;- 1 is a common factor of all numbers.&lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Find all the common factors of these numbers.&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    8 and 12&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 8            :    1, 2, 4, 8&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 12            :    1, 2, 3, 4, 6, 12&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Common factors of 8 and 12    :    1, 2, 4    &lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;2.    6, 12 and 18&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 6            :    1, 2, 3, 6&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 12            :    1, 2, 3, 4, 6, 12&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 18            :    1, 2, 3, 6, 9, 18&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Common factors of 6, 1&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;2 and 18:    1, 2, 3, 6    &lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;3.    27, 36 and 81&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 27            :    1, 3, 9, 27&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 36            :    1, 2, 3, 4, 6, 9, 12, 18, 36&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Factors of 81            :    1, 3, 9, 27, 81&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;4.    Common factors of 27, 36 and 81:    1, 3&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;, 9    &lt;/span&gt;  &lt;span style="font-weight: normal;"&gt;Determine whether&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;1.    6 is a  common factor of 12, 18     and 24&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;12 ÷ 6 = 2 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;18 ÷ 6 = 3 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;24 ÷ 6 = 4 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 6 is a common factor of 12, 18 and 24&lt;/span&gt;    &lt;span style="font-weight: normal;"&gt;2.    9 is a  common factor of 63 and 120&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;63 ÷ 9 = 7 (exact division, no remainder)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;12&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;0 &lt;/span&gt;&lt;span style="font-weight: normal;"&gt;÷ 9 = 13 remainder 3 (not exact division)&lt;/span&gt; &lt;span style="font-weight: normal;"&gt;Therefore 9 is a not common factor of 63 and 120&lt;/span&gt;  &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Highest Common Factors ( HCF )&lt;br /&gt;-&lt;/span&gt; HCF of two or more numbers is the largest common factor of these numbers. &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;a href="http://2.bp.blogspot.com/_VbplSiPqRyo/SqwJ75qMqqI/AAAAAAAAAPI/h1GgtQlbKro/s1600-h/hcf.GIF"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5380686579495643810" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SqwJ75qMqqI/AAAAAAAAAPI/h1GgtQlbKro/s320/hcf.GIF" style="cursor: pointer; height: 257px; width: 320px;" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;2.7 Multiples&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;- The multiples of a number is the product of that number with any whole number except&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;  zero. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;- Multiples are also a sequence.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;List the first five multiples of these numbers.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;3 x 1 = 3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;3 x 2 = 6&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;3 x 3 = 9&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;3 x 4 = 12&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;3 x 5 = 15&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;The first five multiples of 3 are 3, 6, 9, 12 and 15&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;2.    9&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;9 x 1 = 9&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;9 x 2 = 18&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;9 x 3 = 27&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;9 x 4 = 36&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;9 x 5 = 45&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;The first five multiples of 3 are 9, 18, 27, and 45&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;List all the  multiples of these numbers.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    Multiples of 2 between 13 to 27&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;14, 16, 18, 20, 22, 24, 26&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;2.    Multiples of 5 from 50 to 70&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;50, 55, 60, 65, 70&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Determine whether&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    48  is a  multiple of  4&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;48 ÷ 4 = 12 (exact division, no remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Therefore 48  is a multiple of 4&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;2.    26  is a  multiple of  3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;26 ÷ 3 = 3 remainder 2  (not an exact division, has remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Therefore 26  is not a multiple of 3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;2.6 Common Multiples &amp;amp;amp; Lowest Common Multiples (LCM)&lt;br /&gt;&lt;br /&gt;Common Multiples&lt;br /&gt;&lt;/span&gt;- Common multiple is a number that is a multiple of two or more numbers.&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;- Example    8 is a common multiple of 2 and 4&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;        Multiple of 2 : 2, 4, 6, 8, 10, 12 ,…    ( 8 is multiple of 2 )&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;        Multiple of 4 : 4, 8, 12, 16, 20, …    ( 8 is multiple of 4 )&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;        Therefore 8 is a common multiple of 2 and 4&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Find the first three common multiples of these numbers.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    2 and 3&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Multiple of 2     : 2, 4, 6, 8, 10, 12 , 14, 16, 18, 20, …&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Multiple of 3     : 3, 6, 9, 12, 15, 18, 21, 24, …&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Therefore the first three common multiples of 2 and 3 are 6, 12, and 18&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;2.    3, 4 and 6&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Multiple of 3        : 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36,..&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Multiple of 4        : 4, 8, 12, 16, 20, 24, 28, 32, 36, ..&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Multiple of 6        : 6, 12, 18, 24, 30, 36, ..&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Therefore the first three common multiples of  3, 4 and 6  are 12, 24 and 36&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Determine whether&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;1.    50 is a  common multiple  of 2  and  5&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;50 ÷ 2 = 25 (exact division, no remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;50 ÷ 5 = 10 (exact division, no remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Therefore 50 is a  common multiple  of 2  and  5&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;2.    120 is a  common multiple  of 3, 4  and  9&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;120 ÷3  = 40 (exact division, no remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;120 ÷4  =30 (exact division, no remainder)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;120 ÷ 9 = 13 remainder 3 (not exact division)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;Therefore 120 is  not a  common multiple  of 3, 4  and   9&lt;/span&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;\&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html&lt;/b&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Lowest Common Multiples ( LCM )&lt;br /&gt;&lt;/span&gt;- LCM of two or more numbers is the smallest common multiple of these numbers.&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Find the LCM of the followings.&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;1.    6 and 36&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Method 1 : Listing the multiples&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Multiple of 6        : 6, 12, 18, 24, 30, 36, .&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;Multiple of 9        : 9, 18, 27, 36, …&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;The LCM of 6 and 9 is 18&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;and a math test &amp;nbsp;&amp;nbsp;&lt;a href="https://docs.google.com/leaf?id=1pGgYginkioiHLrD_ba5QEEl9i3oi8PxGWT-gUjqhTHzhxMb51d9B0BaFhJpN&amp;amp;sort=name&amp;amp;layout=list&amp;amp;num=50"&gt;&lt;span class="Apple-style-span" style="color: #e06666;"&gt;https://docs.google.com/math exercises&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;whole number lesson&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;a href="https://docs.google.com/leaf?id=1WxPw2LhqeyNK0wrONdEjm2bgsBcPadqKXloY6ZxdiAx2XFfAncqb7TOtrkuh&amp;amp;sort=name&amp;amp;layout=list&amp;amp;num=50"&gt;https://docs.google.com/leaf?id=1WxPw2LhqeyNK0wrONdEjm2bgsBcPadqKXloY6ZxdiAx2XFfAncqb7TOtrkuh&amp;amp;sort=name&amp;amp;layout=list&amp;amp;num=50&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;br /&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;br /&gt;&lt;u&gt;Please leave your comments and notices here below&lt;/u&gt;&lt;/div&gt;&lt;div style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-7830471906043335?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/7830471906043335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/09/number-patterns-and-sequences-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7830471906043335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7830471906043335'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/09/number-patterns-and-sequences-tutorial.html' title='NUMBER PATTERNS AND SEQUENCES TUTORIAL'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_VbplSiPqRyo/SqwFT8mVhzI/AAAAAAAAAOY/hUO_Alzu6Xk/s72-c/even+odd+relation.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-8483627550315821780</id><published>2009-08-30T05:29:00.000-07:00</published><updated>2009-09-22T01:09:29.328-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HCF'/><category scheme='http://www.blogger.com/atom/ns#' term='download'/><category scheme='http://www.blogger.com/atom/ns#' term='problems'/><category scheme='http://www.blogger.com/atom/ns#' term='sheet'/><category scheme='http://www.blogger.com/atom/ns#' term='Mathematics'/><title type='text'>Mathematics  problems sheet</title><content type='html'>&lt;div  style="text-align: center; font-weight: bold;font-family:courier new;"&gt;&lt;span style="font-size:180%;"&gt;Mathemati&lt;/span&gt;&lt;span style="font-size:180%;"&gt;cs problems sheet&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;SEKOLAH MENENG&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;AH K&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;EBANG&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;SAAN BANDAR BINTULU&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;PEPERIKSAAN PENGGAL PERTAMA (PP1) / 20&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;08  &lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;MATEMATIK&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;TINGKATAN 1&lt;/span&gt;&lt;/span&gt; &lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;MASA : 1 JAM 15 &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-family:arial;" &gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left; font-style: italic;"&gt;Name: …………………………………………….                            Class: ………………….&lt;br /&gt;&lt;br /&gt;This paper consists of 40 questions. Answer all the questions. Each question is followed by four options A, B, C and D. For each question, choose the most appropriate answer and blacken your answer on objective answer sheet. You are not allowed to use calculator for this examination.&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/125589473/1f7766d0/math_tests__School_exams_e.html"&gt;&lt;span style="font-family: georgia; color: rgb(102, 51, 102);font-size:180%;" &gt;&lt;span style="text-decoration: underline; font-weight: bold;"&gt;DOWNLOADS&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;1.    The number 513 579 is written as 514 000 when it is rounded off to the nearest &lt;/span&gt;&lt;br /&gt;A.    ten&lt;br /&gt;B.    hundred&lt;br /&gt;C.    thousand&lt;br /&gt;D.    ten thousand&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;2.    Which of the following is equal to  4 558?&lt;/span&gt;&lt;br /&gt;A.    4 000 + 550 + 8&lt;br /&gt;B.    4 000 + 500 + 8&lt;br /&gt;C.    4 500 + 550 + 8&lt;br /&gt;D.    4 550 + 500 + 8&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/Spq7e1PkMYI/AAAAAAAAALI/LJs77h_D250/s1600-h/math_problems.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 83px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/Spq7e1PkMYI/AAAAAAAAALI/LJs77h_D250/s320/math_problems.JPG" alt="" id="BLOGGER_PHOTO_ID_5375815243582943618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;3.    The diagram above shows a group of numbers. Find the difference between the largest and the smallest numbers.&lt;/span&gt;&lt;br /&gt;A.    18&lt;br /&gt;B.    90&lt;br /&gt;C.    99&lt;br /&gt;D.    189&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;4.    When the number 50&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;8 and 79 are subtracted from 6 013, we get &lt;/span&gt;&lt;br /&gt;A.    5 246&lt;br /&gt;B.    5 426&lt;br /&gt;C.    5 546&lt;br /&gt;D.    6 442&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;5.    [ 754 – ( 345 – &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;167 &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;) × 3 ] ÷ 11 &lt;/span&gt;&lt;br /&gt;A.    175&lt;br /&gt;B.    117&lt;br /&gt;C.    108&lt;br /&gt;D.    20'&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;6.    Norman bought 15 boxes of apples. Each box contains 32 apples. If all of the apples are to be distribute&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;d equally&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt; among 24 children in an orphanage, how many apples will each child get?&lt;/span&gt;&lt;br /&gt;A.    10&lt;br /&gt;B.    16&lt;br /&gt;C.    20&lt;br /&gt;D.    30&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;7.    A factory produces 1 560 pairs of shoes per day. In a particular week, 278 pairs were spoilt. If the factory opera&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;tes every day, how many pairs of shoes produced in that week were not spoilt?&lt;/span&gt;&lt;br /&gt;A.    8 974&lt;br /&gt;B.    10 642&lt;br /&gt;C.    10 880&lt;br /&gt;D.    12 866&lt;/div&gt;'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;8.    Mrs. Ramani has 80 pencils, &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;28 erasers and 60 rulers. She wants to prepare some gift packs; each pack containing 5 p&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;encils, 2 erasers and 4 rulers. Find the maximum number of gift packs that she can prepare.&lt;/span&gt;&lt;br /&gt;A.    14&lt;br /&gt;B.    15&lt;br /&gt;C.    16&lt;br /&gt;D.    17&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;9.  &lt;span style="color: rgb(51, 51, 255);"&gt;  In the number sequence, 2, 5, &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;11, x, 32, 47, …, the value of x is&lt;/span&gt;&lt;br /&gt;A.    15&lt;br /&gt;B.    18&lt;br /&gt;C.    20&lt;br /&gt;D.    24&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;10.      11, 13, m, 19, n are prime numbers arranged in ascending order. The value of  m + n  is&lt;/span&gt;&lt;br /&gt;A.    36&lt;br /&gt;B.    38&lt;br /&gt;C.    40&lt;br /&gt;D.    46&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;11.     x is a common multiple of &lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; 3 and 39. Which of the following is not  x ?&lt;/span&gt;&lt;br /&gt;A.    78&lt;br /&gt;B.    117&lt;br /&gt;C.    156&lt;br /&gt;D.    189&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;12.    Find all the prime factors of 102.&lt;/span&gt;&lt;br /&gt;A.    2, 3 and 7&lt;br /&gt;B.    2, 3 and 11&lt;br /&gt;C.    2, 3 and 17&lt;br /&gt;D.    3, 7 and 11&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;13.    The lowest common mult&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;iple (LCM) of 4, 6 and x is 36. The possible value of x is&lt;/span&gt;&lt;br /&gt;A.    18&lt;br /&gt;B.    24&lt;br /&gt;C.    48&lt;br /&gt;D.    56&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;14.    The lowest common multiple&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; (LCM) of which number set below is not 12 ?&lt;/span&gt;&lt;br /&gt;A.    4, 6, 8&lt;br /&gt;B.    3, 4, 6&lt;br /&gt;C.    2, 3, 4&lt;br /&gt;D.    3, 4&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;15.    Find the highest co&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;mmo&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;n factor (HCF) of 16, 24 and 40.&lt;/span&gt;&lt;br /&gt;A.    6&lt;br /&gt;B.    8&lt;br /&gt;C.    12&lt;br /&gt;D.    16&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;16.    Given that ( m–3 ) is th&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;e highest common factor (HCF) of 32 and 40, find the value of  m.&lt;/span&gt;&lt;br /&gt;A.    5&lt;br /&gt;B.    8&lt;br /&gt;C.    11&lt;br /&gt;D.    163&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="file:///D:/My%20Documents/Desktop/math_test.GIF" alt="" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/Spp0wSRzkjI/AAAAAAAAAJo/m2Osn8NEPZs/s1600-h/math_test.GIF"&gt;&lt;img style="cursor: pointer; width: 272px; height: 229px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/Spp0wSRzkjI/AAAAAAAAAJo/m2Osn8NEPZs/s320/math_test.GIF" alt="" id="BLOGGER_PHOTO_ID_5375737478109172274" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp4PLN7oBI/AAAAAAAAAKI/OBGrEIgQUGI/s1600-h/math_exam.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 226px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp4PLN7oBI/AAAAAAAAAKI/OBGrEIgQUGI/s320/math_exam.JPG" alt="" id="BLOGGER_PHOTO_ID_5375741307324702738" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp47azhe-I/AAAAAAAAAKQ/2mBgQanJlDc/s1600-h/mathematic_question.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 201px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp47azhe-I/AAAAAAAAAKQ/2mBgQanJlDc/s320/mathematic_question.JPG" alt="" id="BLOGGER_PHOTO_ID_5375742067423149026" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp5zv98QbI/AAAAAAAAAKY/FPXan46G36A/s1600-h/mathematic_questions.JPG"&gt;&lt;img style="cursor: pointer; width: 246px; height: 272px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp5zv98QbI/AAAAAAAAAKY/FPXan46G36A/s320/mathematic_questions.JPG" alt="" id="BLOGGER_PHOTO_ID_5375743035176665522" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp66esiKSI/AAAAAAAAAKg/jhoweX8k2YA/s1600-h/math_quiz.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 239px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp66esiKSI/AAAAAAAAAKg/jhoweX8k2YA/s320/math_quiz.JPG" alt="" id="BLOGGER_PHOTO_ID_5375744250310961442" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;22.    Given that     4/7  of the students in a class are girls, find the total number of students if 15 of them are boys.&lt;/span&gt;&lt;br /&gt;A.    19&lt;br /&gt;B.    20&lt;br /&gt;C.    35&lt;br /&gt;D.    40&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;23.    Farah is given RM320 by her fa&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;ther.  1/8     and     of the money are used to buy pens and books respectively. How much money has Farah left?&lt;/span&gt;&lt;br /&gt;A.  RM 40&lt;br /&gt;B.  RM 128&lt;br /&gt;C.  RM 152&lt;br /&gt;D.  RM 160&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp8mN5Lu9I/AAAAAAAAAKo/Ffgx8EjvAow/s1600-h/math+checks.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 277px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/Spp8mN5Lu9I/AAAAAAAAAKo/Ffgx8EjvAow/s320/math+checks.JPG" alt="" id="BLOGGER_PHOTO_ID_5375746101226486738" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;25.    Round off 8.0392 to 2 decimal places.&lt;/span&gt;&lt;br /&gt;A.    8.03&lt;br /&gt;B.    8.04&lt;br /&gt;C.    8.05&lt;br /&gt;D.    8.10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/Spp9uX48C1I/AAAAAAAAAKw/FN_oY8VfuSA/s1600-h/geometrytest.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 98px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/Spp9uX48C1I/AAAAAAAAAKw/FN_oY8VfuSA/s320/geometrytest.JPG" alt="" id="BLOGGER_PHOTO_ID_5375747340860394322" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;26.    The diagram above show&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;s number cards. On which of the above number cards does digit 3 have the same value?&lt;/span&gt;&lt;br /&gt;A.    P and Q&lt;br /&gt;B.    P and S&lt;br /&gt;C.    Q and R&lt;br /&gt;D.    Q and S&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;27.    The value of 20.05 + 2.005 round&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;ed off to &lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;1 decimal place is&lt;/span&gt;&lt;br /&gt;A.    22.0&lt;br /&gt;B.    22.06&lt;br /&gt;C.    22.1&lt;br /&gt;D.    22.10&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;28.    Which of the following decimals are in descending order?&lt;/span&gt;&lt;br /&gt;A.    0.007, 0.017, 0.7, 1.07, 1.70&lt;br /&gt;B.    1.70, 1.07, 0.7, 0.017, 0.007&lt;br /&gt;C.    1.07, 1.70, 0.7, 0.007, 0.017&lt;br /&gt;D.    1.70, 0.7, 0.017, 0.007, 1.07&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;29.    Which of the following is not true?&lt;/span&gt;&lt;br /&gt;A.    3.092 × 100 = 309.2&lt;br /&gt;B.    0.2 × 0.4 = 0.8&lt;br /&gt;C.    7.59 × 10 = 75.9&lt;br /&gt;D.    0.5 × 20 = 10&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;30.    If 4.5 kg of oranges cost RM 12.60, calculate the price of 3.2 kg of oranges.&lt;/span&gt;&lt;br /&gt;A.    RM 6.00&lt;br /&gt;B.    RM 8.96&lt;br /&gt;C.    RM 13.90&lt;br /&gt;D.    RM 20.30&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;31.    The product of three numbers is 11.88 . If two of the numbers are 3.3 and 2, what is the third number?&lt;/span&gt;&lt;br /&gt;A.    1.8&lt;br /&gt;B.    2.4&lt;br /&gt;C.    2.6&lt;br /&gt;D.    3.1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;32.    Aida, Siew May and Betty&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt; donated RM164.45 to a charity fund. If Siew May and Betty donated the same amount and Aida donated RM5.75 more than Betty, what was the amount donated by Aida?&lt;/span&gt;&lt;br /&gt;A.    RM 52.90&lt;br /&gt;B.    RM 58.65&lt;br /&gt;C.    RM 79.35&lt;br /&gt;D.    RM 85.10&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;33.     Convert    into percentage.&lt;/span&gt;&lt;br /&gt;A.    45%&lt;br /&gt;B.    60%&lt;br /&gt;C.    75%&lt;br /&gt;D.    80%&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;34.     38% of 250 is&lt;/span&gt;&lt;br /&gt;A.    85&lt;br /&gt;B.    93&lt;br /&gt;C.    95&lt;br /&gt;D.    155&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;35.    If   p × 8  =  0.12, what is the value of  p?&lt;/span&gt;&lt;br /&gt;A.    1.5%&lt;br /&gt;B.    2.0%&lt;br /&gt;C.    2.5%&lt;br /&gt;D.    3.0%&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;36.     90 out of 225 in percentage is &lt;/span&gt;&lt;br /&gt;A.    15%&lt;br /&gt;B.    20%&lt;br /&gt;C.    25%&lt;br /&gt;D.    40%&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;37.    Mamat’s monthly salary is RM 2400. He spends RM 1824 each month and saves the balance of the salar&lt;/span&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;y in the bank. What percentage of his salary is saved?&lt;/span&gt;&lt;br /&gt;A.    24%&lt;br /&gt;B.    25%&lt;br /&gt;C.    26%&lt;br /&gt;D.    27%&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;38.     A total of 200 pupils visited a public library on a certain Friday. 40% of them were girls. The number of boys who visited the library increased by 50% the next day. Calculate the total number of boys who visited the library on the two days, Friday and Saturday?&lt;/span&gt;&lt;br /&gt;A.    60&lt;br /&gt;B.    80&lt;br /&gt;C.    180&lt;br /&gt;D.    300&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;39.    The price of a school bag is RM 95. Find the price of the school bag after a  20% discount.&lt;/span&gt;&lt;br /&gt;A.    RM 19&lt;br /&gt;B.    RM 66&lt;br /&gt;C.    RM 76&lt;br /&gt;D.    RM 114&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp_LwQ_MBI/AAAAAAAAAK4/dM3k3aUWdeM/s1600-h/total+number+figures.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 191px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/Spp_LwQ_MBI/AAAAAAAAAK4/dM3k3aUWdeM/s320/total+number+figures.JPG" alt="" id="BLOGGER_PHOTO_ID_5375748945131548690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;40.     Table above shows the number of foreign workers employed by a factory in 3 years. Which of the following statements is false?&lt;/span&gt;&lt;br /&gt;A.    80% of the workers in year 2001 are&lt;br /&gt;foreign workers.&lt;br /&gt;B.    28 % of the workers in year 2002 and&lt;br /&gt;2003 are not foreign workers.&lt;br /&gt;C.    The percentage of foreign workers in years 2002 and 2003 is the same.&lt;br /&gt;D.    Year 2001 has the lowest percentage of&lt;br /&gt;foreign workers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Answer scheme sheet&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/SpqAbx4pTBI/AAAAAAAAALA/8lXL3f68JYE/s1600-h/answer+scheme+math1+paper.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 270px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SpqAbx4pTBI/AAAAAAAAALA/8lXL3f68JYE/s320/answer+scheme+math1+paper.JPG" alt="" id="BLOGGER_PHOTO_ID_5375750319955856402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="file:///D:/My%20Documents/Desktop/math_exam.JPG" alt="" /&gt;&lt;img src="file:///D:/My%20Documents/Desktop/math_exam.JPG" alt="" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-8483627550315821780?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/8483627550315821780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/08/mathematics-problems-sheet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8483627550315821780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8483627550315821780'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/08/mathematics-problems-sheet.html' title='Mathematics  problems sheet'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VbplSiPqRyo/Spq7e1PkMYI/AAAAAAAAALI/LJs77h_D250/s72-c/math_problems.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-2896492231447179572</id><published>2009-08-22T02:01:00.000-07:00</published><updated>2009-08-22T02:32:42.288-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='thousand'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Math Test</title><content type='html'>In Math test&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/125589473/1f7766d0/math_tests.html"&gt;Download Now&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center; font-family: verdana;"&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;SECOND PROGRESSIVE TEST (UK 2)  / 2009 &lt;br /&gt;MATHEMATICS&lt;br /&gt;FORM 1&lt;br /&gt;TIME : 1 HOUR&lt;br /&gt;PREPARED BY :  CIK HJH NOR HAZRINA HJ HADZELAN&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left; font-weight: bold; font-family: arial;"&gt;AME : _________________________________                    FORM : ____________&lt;br /&gt;&lt;br /&gt;SECTION A ( 40 Marks )&lt;br /&gt;This section contains 20 objective questions. Answer all questions. Each question is followed by four answer choices A, B, C and D. Choose one answer only. Write your answers in space provided. Calculator is not allowed.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;1.    The place value of digit 1 in the number 513 029 is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.    Hundreds&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.    Thousands&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.    Ten thousands&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.    Hundred thousands&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;2.    Among the following numbers, which becomes  632 000  when rounded off  to the nearest thousand?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  631 099&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  631 201&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  631 487&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  631 500&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;3.    The diagram above shows a group of numbers. Find he difference between the largest and the smallest number.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  199&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  450&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  504&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  549&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;4.    The remainder of  7 739  18&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  17&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  19&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  349&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  429&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;        5  7  6&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;             8  9&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;             5  1  8  4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;             +      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;    ____________&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;         5  1  2  6  4&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 51, 51);"&gt;5.    The calculation above shows the multiplication of 576 and 89. What is the number in the box?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  4 068&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  4 568&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  4 608&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  4 768&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;6.    Saiful bought 24 boxes of pens and each box contains 96 pens. He sold the pens at RM 3 each. Calculate the amount of money he got from selling all the pens. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  RM 2 304&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  RM 5 550&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  RM 6 912&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  RM 7 300&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;7.    48  +  15   60  12  =&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  63   5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  48  +  75&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  25  +  15   5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  4  +  15   60&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;8.    192   3 ( 6 + 2 )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  48&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  386&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  512&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;9.    Ling has 49 marbles, which are 19 less than Muthu but 13 more than Nazrul. To start a game, all marbles from three players are collected and divided equally among them. The number of marbles each player will have is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  39&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  43&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  51&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  57&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;10.    A school buys 310 boxes of pencils. There are 18 pencils in each box. After giving every student 4 pencils each, there are 180 pencils left. The number of students in the school is &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  1 350&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  1 440&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  5 440&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  5 760&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;11.               109, 89, 76, x , 50, ...  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;       The value of  x in the number sequence  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;       above is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  60&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  63&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  65&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  79&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;12.               1,  2,  5,   p,  17,  26,  q,  ...  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;    The list of numbers above is a  number sequence. The value of   p + q  is &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  35&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  42&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  44&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  47&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;13.          m,  37,  41,  43,  n,  ...  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;    The list of numbers above is a sequence of prime numbers in ascending order. The value of   n - m  is &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  12&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  14&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  16&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;14.    Given that 8 and 9 are the factors of Y. What is the possible value of Y?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  63&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  96&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  126&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  144&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;1&lt;span style="color: rgb(51, 0, 0);"&gt;5.    Given that  2 and 3 are the prime factors of 132. The other prime factor of 132 is       &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  11&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  9&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  7&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;16.    Which of the following numbers is the lowest common multiple (LCM) of 6, 8 and 12?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  12&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  24&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  48&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  72&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;17.    112 is the common multiple of  8 and  x. Among the following, which is not a value of x ?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  14&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  18&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  28&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  56&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;18.    The total number of common factors of 12, 18 and 48  is&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  6&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;&lt;span style="color: rgb(51, 0, 0);"&gt;19.    Which of the following pairs of numbers has 6 as the highest common factor (HCF)?&lt;/span&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  12 and 36&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  18 and 24&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  18 and 36&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  42 and 84&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial; color: rgb(51, 0, 0);"&gt;20.    Given that ( x – 7 ) is the highest common factor of  24 and 32. Find the value of x. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;A.  4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;B.  8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;C.  11&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal; font-family: arial;"&gt;D.  15&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center; font-family: georgia;"&gt;SECTION B ( 60 Marks )&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: georgia;"&gt;This section contains 10 subjective questions. Answer all questions. Write your answers in space provided. All the workings must be shown.  Calculator is not allowed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;1. a) Write 2 950 611 in words.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;(2 marks)                                                                         &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;1. b) State the place value and the value of  digit   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;        9  in  390 451        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;                                                                                          &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;        Place Value:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;        Value of digit :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;(4 marks)                                                                         &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;2. Round off  796 145 to the nearest&lt;br /&gt;   a) thousands&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;  b) ten thousands&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;  c) hundred thousands&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;. Calculate the followings&lt;br /&gt;&lt;br /&gt;  a)  26 705 + 57 + 6 998 =&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)&lt;br /&gt;  b) 96   24  =&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4&lt;/span&gt;. Calculate the followings&lt;br /&gt;&lt;br /&gt;a)  54 + 1 575 25  =&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)&lt;br /&gt;  b) 110 – 3 ( 16 + 24  4 ) =&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="Edit-Time-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_editdata.mso"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-ansi-language:EN-US; 	mso-fareast-language:EN-US;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" style="'width:73.5pt;"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\Personal\LOCALS~1\Temp\msohtml1\01\clip_image001.emz" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/Personal/LOCALS%7E1/Temp/msohtml1/01/clip_image002.gif" shapes="_x0000_i1025" width="98" height="113" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  The method above is used to find the Lowest &lt;br /&gt;   Common Multiples (LCM) of   54 and   n .&lt;br /&gt;   Find the value of   n    m&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6. Find the sum of Highest Common Factor  (HCF)&lt;br /&gt;    of 12 and 18 and Highest Common Factor (HCF)&lt;br /&gt;    of 12 and 24.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7. a)  Find the value of    &lt;br /&gt;         Give your answer correct to 2 decimal places.&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="Edit-Time-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_editdata.mso"&gt;&lt;link rel="OLE-Object-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_oledata.mso"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-ansi-language:EN-US; 	mso-fareast-language:EN-US;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;7. b)&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="position: relative; top: 11pt;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" style="'width:21pt;" ole=""&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\Personal\LOCALS~1\Temp\msohtml1\01\clip_image001.wmz" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/Personal/LOCALS%7E1/Temp/msohtml1/01/clip_image002.gif" shapes="_x0000_i1025" width="28" height="39" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:oleobject type="Embed" progid="Equation.3" shapeid="_x0000_i1025" drawaspect="Content" objectid="_1312362312"&gt;  &lt;/o:OLEObject&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;&lt;span style=""&gt;   &lt;/span&gt;13&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;´&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;&lt;span style=""&gt;  &lt;/span&gt;1.25 &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;8.  a)  Write  32 %  as a fraction in its lowest term.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9.  a)  Find the number if   4.5 %  of a number is  27.&lt;br /&gt;9.  b)  Find the final value of  900 increased by  5%&lt;br /&gt;&lt;br /&gt;10. Susan has 30 metres of fabric. She used 18.4&lt;br /&gt;      metres of  the fabric and sells the remainder to&lt;br /&gt;      Mimi for RM 3.50 per metre. How much does&lt;br /&gt;      Mimi has to pay to Susan?&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-ansi-language:EN-US; 	mso-fareast-language:EN-US;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;11.&lt;span style=""&gt;  &lt;/span&gt;Lee bought a bicycle for RM 400. Later he&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;&lt;span style=""&gt;       &lt;/span&gt;sold the bicycle to Rama for a profit of RM 70.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;&lt;span style=""&gt;       &lt;/span&gt;Find the percentage of profit.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;12.  a)  Arrange the following in decreasing order.&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="Edit-Time-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_editdata.mso"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:595.3pt 841.9pt; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:shapedefaults ext="edit" spidmax="1028"&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:shapelayout ext="edit"&gt;   &lt;o:idmap ext="edit" data="1"&gt;  &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t202" coordsize="21600,21600" spt="202" path="m,l,21600r21600,l21600,xe"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:path gradientshapeok="t" connecttype="rect"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_s1027" type="#_x0000_t202" style="'position:absolute;"&gt;  &lt;v:textbox style="'mso-next-textbox:#_x0000_s1027'"&gt;   &lt;![if !mso]&gt;   &lt;table cellpadding="0" cellspacing="0" width="100%"&gt;    &lt;tr&gt;     &lt;td&gt;&lt;![endif]&gt;     &lt;div&gt;     &lt;p class="MsoNormal"&gt;&lt;span style="'font-size:11.0pt'"&gt;-7&lt;span style="'mso-spacerun:yes'"&gt;  &lt;/span&gt;,&lt;span style="'mso-spacerun:yes'"&gt;      &lt;/span&gt;4&lt;span style="'mso-spacerun:yes'"&gt;  &lt;/span&gt;,&lt;span style="'mso-spacerun:yes'"&gt;   &lt;/span&gt;-11&lt;span style="'mso-spacerun:yes'"&gt;      &lt;/span&gt;,&lt;span style="'mso-spacerun:yes'"&gt;  &lt;/span&gt;16&lt;span style="'mso-spacerun:yes'"&gt;  &lt;/span&gt;,&lt;span style="'mso-spacerun:yes'"&gt;      &lt;/span&gt;-2&lt;/span&gt;&lt;/p&gt;     &lt;/div&gt;     &lt;![if !mso]&gt;&lt;/td&gt;    &lt;/tr&gt;   &lt;/table&gt;   &lt;![endif]&gt;&lt;/v:textbox&gt;  &lt;w:wrap type="square"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/Personal/LOCALS%7E1/Temp/msohtml1/01/clip_image001.gif" alt="مربع نص: -7  ,  4  ,   -11  ,  16  ,  -2" shapes="_x0000_s1027" align="left" width="173" height="30" hspace="12" /&gt;&lt;!--[endif]--&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-7  ,  4  ,   -11  ,  16  ,  -2&lt;br /&gt;&lt;br /&gt;12. b) Figure below shows a number sequence.&lt;br /&gt;          Determine the value of   m  +  n .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;20  ,  m  ,  -10  ,  -5  ,   0  ,   n   , 10&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;14. The temperature of a town in the morning is&lt;br /&gt;      3C.  During the afternoon the temperature&lt;br /&gt;     increases 11C  and later at night it drops 25C.&lt;br /&gt;    What is the temperature during the night?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;15.  a)  Mr.  f   drives a distance of    k   km from&lt;br /&gt;            City  p   to  City  q  in  just  30  minutes.&lt;br /&gt;            State the unknown.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;15. b) Pick out the like terms in the following.&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="Edit-Time-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_editdata.mso"&gt;&lt;link rel="OLE-Object-Data" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_oledata.mso"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-ansi-language:EN-US; 	mso-fareast-language:EN-US;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;10 &lt;i style=""&gt;p&lt;/i&gt;&lt;span style=""&gt;  &lt;/span&gt;,&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;14 &lt;i style=""&gt;r&lt;/i&gt;&lt;span style=""&gt;  &lt;/span&gt;,&lt;span style=""&gt;  &lt;/span&gt;9.3 &lt;i style=""&gt;y&lt;/i&gt;&lt;span style=""&gt;  &lt;/span&gt;,&lt;span style=""&gt;  &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="position: relative; top: 11pt;"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:formulas&gt;  &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;  &lt;o:lock ext="edit" aspectratio="t"&gt; &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1025" type="#_x0000_t75" style="'width:9.75pt;" ole=""&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\Personal\LOCALS~1\Temp\msohtml1\01\clip_image001.wmz" title=""&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///C:/DOCUME%7E1/Personal/LOCALS%7E1/Temp/msohtml1/01/clip_image002.gif" shapes="_x0000_i1025" width="13" height="37" /&gt;&lt;!--[endif]--&gt;&lt;/span&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:oleobject type="Embed" progid="Equation.3" shapeid="_x0000_i1025" drawaspect="Content" objectid="_1312362698"&gt;  &lt;/o:OLEObject&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;i style=""&gt;r&lt;/i&gt;&lt;span style=""&gt;  &lt;/span&gt;,&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt;" lang="EN-US"&gt;8 &lt;i style=""&gt;u&lt;/i&gt;&lt;span style="border: 1pt solid windowtext; padding: 0in;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CPersonal%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman"; 	mso-ansi-language:EN-US; 	mso-fareast-language:EN-US;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"جدول عادي"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt;16. a)&lt;span style=""&gt;  &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;10 &lt;i style=""&gt;h&lt;/i&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;  &lt;/span&gt;2&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt;  &lt;/span&gt;16&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: Symbol;" lang="EN-US"&gt;&lt;span style=""&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 12pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt; &lt;/span&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Times New Roman&amp;quot;;" lang="EN-US"&gt;&lt;span style=""&gt; &lt;/span&gt;6 &lt;i style=""&gt;h&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;17. Julie buys a story book which costs RM y.  She&lt;br /&gt;      pays with a RM 50 note. Write an algebraic&lt;br /&gt;      expression to shows the balance of money she&lt;br /&gt;      will receive&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;19. a)   A journey from Bintulu to Kuching takes&lt;br /&gt;            5 hours.  A bus departs from Bintulu at&lt;br /&gt;            10.30 a.m. State the time in the 24-hour &lt;br /&gt;            system that the bus arrives at Kuching.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;19 b)  The weight of  1 packet of sugar is 495 g.&lt;br /&gt;          If Komala buys  8 packets of sugar, what is the&lt;br /&gt;          total weight of sugar, in kg , Komala bought?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;20.   Figure below shows the various routes a traveller can takes to go from town A to town D.&lt;br /&gt;        Calculate the difference between the longest route and the shortest route to go from town A to town D.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1.  a)  Write 2 750 438 in words.                                       b)  State the place value and the value of         &lt;br /&gt;                                                                                                digit  9 in 597 143&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                            (2 marks)                                                                         (4 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2.  Round off   818 795  to the nearest&lt;br /&gt;     a)  ten.                                            b)  thousand.                                     c)  hundred thousand.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;                                   (2 marks)                                          (2 marks)                                        (2 marks)&lt;br /&gt;3.   a)  Find the sum of  207,  4 659  and  13 022.      b)  Find the difference between  97 501  and  899.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                            (3 marks)                                                                       (3 marks)&lt;br /&gt;4.  Table below shows the number of visitors who visited Zoo Negara from March to June&lt;br /&gt;     in a particular year.&lt;br /&gt;Month    March    April    May    June&lt;br /&gt;Number of visitors    4 079    3 788    2 413    3 990&lt;br /&gt;&lt;br /&gt;    a)  Calculate the total number of visitors from         b)  Round off the total number of visitors to the&lt;br /&gt;         March to June.                                                           nearest hundred.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                           (4 marks)                                                                         (2 marks)&lt;br /&gt;5.  Calculate the followings.&lt;br /&gt;    a)  592   8                                   b)   405   16                                c)  11 172    12&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                         &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                               (2 marks)                                            (3 marks)                                          (3 marks)&lt;br /&gt;6.  If   4  tailors can each sew  8  shirts in a day,  how many shirts can they sew altogether in 3 weeks?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(4 marks)                                                                        &lt;br /&gt;7.  Calculate the followings.&lt;br /&gt;    a)  45 + 135 5 - 16                    b)   114  3 +  7   12                     c)  95 – 2 ( 12 + 42  7 )&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                         &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                 (3 marks)                                          (3 marks)                                        (3 marks)&lt;br /&gt;8.  Siew Lan had RM 107.  She bought a story book for RM 14 . She also bought  eight  boxes of&lt;br /&gt;    colour pencils which is cost  RM 6 each. Find the balance of her money.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)                                           &lt;br /&gt;9.  a)  Complete the following number sequence.&lt;br /&gt;&lt;br /&gt;           5,  11,  17, ______,  ______,  ______,  41&lt;br /&gt;(3 marks)&lt;br /&gt;&lt;br /&gt;     b)  In the number sequence below, find the value of  x  +   y&lt;br /&gt;&lt;br /&gt;                                    1,  2,  4,  x , 16,   y                              &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; (3 marks)&lt;br /&gt;10. a)  List out all the odd numbers between  44 and  52.&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;     b)  Find the sum of  all the even numbers that are less than 9.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;     a)  List out the first two prime numbers that are greater than  90.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SECTION B ( 60 Marks )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;This section contains 10 subjective questions. Answer all questions. Write your answers in space provided. All the workings must be shown.  Calculator is not allowed.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1.  a)  Write 2 750 438 in words.                                       b)  State the place value and the value of         &lt;br /&gt;                                                                                                digit  9 in 597 143&lt;br /&gt;    two million seven hundred and fifty thousand                   &lt;br /&gt;     four hundred and thirty-eight                                           place value : ten thousands&lt;br /&gt;                                                                                               value of digit : 90 000&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                            (2 marks)                                                                         (4 marks)&lt;br /&gt;2.  Round off   818 795  to the nearest&lt;br /&gt;     a)  ten.                                            b)  thousand.                                     c)  hundred thousand.&lt;br /&gt;&lt;br /&gt;          818 800                                           819 000                                               800 000&lt;br /&gt;   &lt;br /&gt;                                   (2 marks)                                          (2 marks)                                        (2 marks)&lt;br /&gt;3.   a)  Find the sum of  207,  4 659  and  13 022.      b)  Find the difference between  97 501  and  899.&lt;br /&gt;&lt;br /&gt;             207  +  4 659  +  13022                                         97 501  -  899&lt;br /&gt;         =  17 888                                                               =   96 602&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                            (3 marks)                                                                       (3 marks)&lt;br /&gt;4.  Table below shows the number of visitors who visited Zoo Negara from March to June&lt;br /&gt;     in a particular year.&lt;br /&gt;Month    March    April    May    June&lt;br /&gt;Number of visitors    4 079    3 788    2 413    3 990&lt;br /&gt;&lt;br /&gt;    a)  Calculate the total number of visitors from         b)  Round off the total number of visitors to the&lt;br /&gt;         March to June.                                                           nearest hundred.&lt;br /&gt;&lt;br /&gt;             4 079  +  3 788 +  2 413 +  3 990                                  14 300 visitors&lt;br /&gt;        =  14 270 visitors&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                                           (4 marks)                                                                         (2 marks)&lt;br /&gt;5.  Calculate the followings.&lt;br /&gt;    a)  592   8                                   b)   405   16                                c)  11 172    12&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                         &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                               (2 marks)                                            (3 marks)                                          (3 marks)&lt;br /&gt;6.  If   4  tailors can each sew  8  shirts in a day,  how many shirts can they sew altogether in 3 weeks?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                       4   8   7    3  = 672 shirts&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(4 marks)                                                                        &lt;br /&gt;7.  Calculate the followings.&lt;br /&gt;    a)  45 + 135 5 - 16                    b)   114  3 +  7   12                     c)  95 – 2 ( 12 + 42  7 )&lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;         45 + 27 – 16                                  38 + 7 X 12                                     95 – 2 ( 12 + 6 )&lt;br /&gt;     =  72 – 16                                      =  38 + 84                                        =  95  - 2 ( 18 )&lt;br /&gt;     =  56                                              =  122                                              =  95 - 36     &lt;br /&gt;                                                                                                                   =   59&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                                 (3 marks)                                          (3 marks)                                        (3 marks)&lt;br /&gt;8.  Siew Lan had RM 107.  She bought a story book for RM 14 . She also bought  eight  boxes of&lt;br /&gt;    colour pencils which is cost  RM 6 each. Find the balance of her money.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        RM 107 – RM 14 – ( RM 6    8 )&lt;br /&gt;    =   RM 107 – RM 14 – RM 48&lt;br /&gt;    =   RM 45&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;(3 marks)                                           &lt;br /&gt;9.  a)  Complete the following number sequence.&lt;br /&gt;&lt;br /&gt;           5,  11,  17, __23____,  __29____,  ___35___,  41    ( pattern :  +6 )&lt;br /&gt;(3 marks)&lt;br /&gt;&lt;br /&gt;     b)  In the number sequence below, find the value of  x  +   y&lt;br /&gt;&lt;br /&gt;                                    1,  2,  4,  x , 16,   y                    ( pattern :    2 )          &lt;br /&gt;&lt;br /&gt;                    x = 8,  y = 32                      x  +   y = 8 + 32  = 40&lt;br /&gt;&lt;br /&gt; (3 marks)&lt;br /&gt;10. a)  List out all the odd numbers between  44 and  52.&lt;br /&gt;            45, 47, 49, 51&lt;br /&gt;(2 marks)&lt;br /&gt;     b)  Find the sum of  all the even numbers that are less than 9.&lt;br /&gt;          2 + 4 + 6 + 8 = 20&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;     a)  List out the first two prime numbers that are greater than  90.&lt;br /&gt;            97 and 101&lt;br /&gt;&lt;br /&gt;(2 marks)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-2896492231447179572?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/2896492231447179572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/08/math-test.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2896492231447179572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2896492231447179572'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/08/math-test.html' title='Math Test'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-5551388422849303397</id><published>2009-07-29T00:17:00.000-07:00</published><updated>2009-07-29T00:27:54.902-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Technology'/><category scheme='http://www.blogger.com/atom/ns#' term='Terms'/><category scheme='http://www.blogger.com/atom/ns#' term='Information'/><category scheme='http://www.blogger.com/atom/ns#' term='task'/><category scheme='http://www.blogger.com/atom/ns#' term='elements'/><category scheme='http://www.blogger.com/atom/ns#' term='business'/><title type='text'>Information Technology Terms</title><content type='html'>&lt;span style="font-size:130%;"&gt;&lt;span style="font-family:georgia;"&gt;In following  article we discussed some terms  and issues related  to Information technology &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Information-processing technology&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Information-processing technology, or just information technology (IT), is the most common single type of technology within operations and includes any device which collects, manipulates, stores or distributes information.  Often organizational and operational issues are the main constraints in applying information technology because managers are unsure how best to use the potential in the technology.  The following quotation gives some idea of how fast information technology has changed: The rate of progress in information technology has been so great that if comparable advances had been made in the automotive industry, you could buy a Jaguar that would travel at the speed of sound, go 600 miles on a thimble of gas and cost only $2!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Centralized and decentralized information processing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;All computers used for management purposes were, at one time, large and centralized.  It was simply the most economical way of buying processing power.  Then the cost and power of smaller computers reached the point where it was economical feasible for different parts of the operation to have their own dedicated computer under the direct control of the staff who would use them.  This is the distributed processing concept.  The obvious problem with such an arrangement was that, in bringing computing power closer to its users, coordinating all the various processing activities became more complex.  The answer to the problem was for the distributed computers to exchange information.  This eventually led to the concept of the network.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Telecommunications and information technology&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Computer-based technologies in business use have always been based on digital principles (converting information into a binary form using 0s and 1s).  Telecommunications, mean while were originally based on analogue technology.  The digitization of telecommunications transmissions (including digital compression techniques, which allow information to be squeezed into a smaller ‘space’ so that more can be sent using a given amount of transmission capacity), together with the use of high-capacity optical fibre networks, brought new possibilities.  The technologies of computing and telecommunications in effect merged.  Digital telecommunication lines could carry both voice and non-voice (text, data, etc.) traffic at the same time, so separate sites of the same organization, or separate operations, could lease lines for their exclusive use.  Alternatively, separate operations could use one of the public integrated services digital networks (ISDNs).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The internet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Undoubtedly the most significant technology to impact on operations management in the last few years has been the internet.  In effect, the internet is a ‘network of networks’.  It is used to link computer networks with other computer networks.  Its origin lies in the development of LANs in the 1970s and 1980s (and later, wide area networks, WANs).  However, because they used different types of computer, LANs usually found it difficult to talk to each other.  Nor did WANs use the same language as LANs.  The breakthrough came with the development of a technique called ‘packet switching’.  This enabled many messages to be sent to different locations at the same time and allowed individual networks to communicate.  In practical terms, though, most of us think of the internet as the provider of services such as the ability to browse the World Wide Web.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;E-business&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The use of internet –based technology, either to support existing business processes or to create entirely new business opportunities, has come to be known as e-business.  The most obvious impact has been on those operations and business processes that are concerned with the buying and selling activity (e-commerce).  The internet provided a whole new channel for communicating with customers.  The advantage of internet selling was that it increased both reach (the number of customers who could be reached and the number of items they could be presented with) and richness (the amount of detail which could be provided concerning both the items on sale and customers’ behaviour in buying them).  Traditionally, selling involved a trade-off between reach and richness.  The internet effectively overcame this trade-off.  However, the internet had equally powerful implications for the ongoing provision of services.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;M-business&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The major impact of the internet on so many areas of business has been further boosted by developments in mobile technology.  M-business is the phrase now frequently used to cover applications that combine broadband internet and mobile technology devices.  For example, some financial services offer their customers access to their accounts through personal digital assistance (PDAs) and mobile (cell) phones.  But in business, applications are not limited to enhanced customer service.  Generally, communications between staff, especially those who spend much of their time away from the operations, such as sales people, can be significantly facilitated.  Mobile communications of this type offer the potential for significant cost savings as well as new business opportunities.  However, as with all wireless applications, security concerns can prove a problem in some applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Management information systems (MIS)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Within the configuration of any information-processing technology, what is important is the way in which information moves, is changed, is manipulated and presented so that it can be used in managing an organization.  These systems are management information systems.  Operations managers make considerable use of MISs, especially in their planning and control activities.  Systems which are concerned with inventory management, the timing and scheduling of activities, demand forecasting, order processing, quality management and many other activities are an integral part of many operations managers’ working lives and are referred to in the planning and control.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Decision support systems (DSSs)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A decision support system is one which provides information with the direct objective of aiding or supporting managerial decision making.  It does this by storing relevant information, processing it and presenting it in such a way as to be appropriate to the decision being made.  In this way, it supports managers by helping them to understand the nature of decisions and their consequences, but it does not actually make the decision itself.  Often DSSs are used for ‘what if’ analyses which explore the (often financial) consequences of changing operations practice.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Expert systems (ESs)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Expert systems take the idea of DSSs one stage further in that they attempt to ‘solve’ problems that would normally be solved by humans.  An ES exhibits (within a specified area) a sufficient degree of expertise to mimic human problem solving.  The key part of an ES is its ‘inference engine’ which performs the reasoning or formal logic on the rules that have been defined as governing the decision.  These rules are called the ‘knowledge base’ of the ES (which is why ESs are also called knowledge-based systems).  There have been many attempts to utilize the idea of an ES in operations management.  Although authorities agree that ESs will become far more important in the future of operations management, not all applications so far have been totally successful.  The problems which have been encountered include the following:&lt;br /&gt;&lt;br /&gt;   * Most expert systems can treat only narrow problems rather than the more realistic issues of integration and conflict between problem areas of the operation.&lt;br /&gt;   * Putting even some of an operations manager’s expertise into a knowledge base is very expensive in terms of time and processing power.&lt;br /&gt;   * Like all information-based systems, it is rendered impotent if the data it is working with are wrong or inaccurate.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The elements of job design&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Job design involves a number of separate yet related elements which when taken together define the jobs of the people who work in the operation.  Whether you are managing an Egyptian quarry, providing adventure holidays, running a software consultancy or a tax advice office, or building cars, there are six key elements of job design that you will need to consider.&lt;br /&gt;&lt;br /&gt;What are the environmental conditions of the workplace?&lt;br /&gt;&lt;br /&gt;The conditions under which jobs are performed will have a significant impact on people’s effectiveness, comfort and safety.  This is called ergonomic environmental design.  It is concerned with issues such as noise, heat and light in the workplace.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What technology is available and how will it be used?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The vast majority of operational tasks require the use of technology, even if the technology is not sophisticated.  Not only does the technology need to be appropriate and designed well, so does the interface between the people and the hardware.  This is called ergonomic workplace design.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What tasks are to be allocated to each person in the operation?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Producing goods and services involves a whole range of different tasks which need to be divided between the people who staff the operation.  Different approaches to the division of labour will lead to different task allocations.&lt;br /&gt;&lt;br /&gt;What is the best method of performing each job?&lt;br /&gt;&lt;br /&gt;Every job should have any approved method of completion and this should be the ‘best’ method.  Although there are different ideas of what is ‘best’, it is generally the most efficient method but that fits the task and does not unduly interfere with other tasks.  This is usually referred to as work study – one element of scientific management.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How long will it take and how many people will be needed?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The second element of scientific management is work measurement.  Work measurement helps us calculate the time required to do a job so that we can then work out how many people we will need.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How do we maintain commitment?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Keeping staff motivated is not easily.  There is a danger that in considering the previous questions it may be tempting to see the person as a unit of resource rather than a human being with feeling and emotions.  So understanding how we can encourage people and maintain their commitment is the most important of the issues in job design and work organization.  This is concerned with the behavioural approaches to job design including empowerment, teamwork and flexible working.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End of Information Technology terms&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-5551388422849303397?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/5551388422849303397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/information-technology-terms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5551388422849303397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5551388422849303397'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/information-technology-terms.html' title='Information Technology Terms'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-77049718215918478</id><published>2009-07-14T07:05:00.000-07:00</published><updated>2009-07-15T11:47:02.584-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='program'/><category scheme='http://www.blogger.com/atom/ns#' term='sample'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='c'/><title type='text'>c samples program</title><content type='html'>In this c sample program compile the following codes and see the output&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;PROG: butter&lt;br /&gt;LANG: C++&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/118332673/85238190/c_heap_sort.html"&gt;download c_heap_sort &lt;/a&gt;&lt;br /&gt;        //In the name of God&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;algorithm&gt;&lt;br /&gt;#include &lt;vector&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;const int P = 800 + 10, N = 500 + 10, inf = P * N * 225;&lt;br /&gt;int h[P], nh = 0, ver[P], ind[P], t[30], hh;&lt;br /&gt;vector &lt;int&gt; v[P];&lt;br /&gt;&lt;br /&gt;inline void my_swap (int x, int y) {&lt;br /&gt; swap (ver[x], ver[y]);&lt;br /&gt; swap (ind[ ver[x] ], ind[ ver[y] ]);&lt;br /&gt; swap (h[x], h[y]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//x == index&lt;br /&gt;void bobble_up (int x) {&lt;br /&gt; if (x != 1 &amp;amp;&amp;amp; h[x] &lt; x ="="" mc =" x;"&gt; h[x*2] &amp;amp;&amp;amp; x*2&lt;=nh)   mc = x*2;  if (h[mc] &gt; h[x*2 + 1] &amp;amp;&amp;amp; x*2+1 &lt;= nh)   mc = x*2+1;  if (mc != x) {   my_swap (x, mc);   bobble_down (mc);  } }  //x != index &amp;amp;&amp;amp; x == value inline void insert_key (int x) {  h[++nh] = x;  bobble_up (nh); }  inline int extract_min () {  int r = h[1];  my_swap(1, nh--);  bobble_down(1);  return r; }  //x == index inline void modifi_key (int x, int val) {  h[x] = val;  bobble_up (x);  bobble_down (x); }  int main () {  int x;  while (cin &gt;&gt; x) {&lt;br /&gt;  insert_key (x);&lt;br /&gt;  t[hh++] = x;&lt;br /&gt;  cerr &lt;&lt; x &lt;&lt; endl;&lt;br /&gt; }&lt;br /&gt; cerr &lt;&lt; "hello\n";&lt;br /&gt; sort (t, t+hh);&lt;br /&gt; /*for (int i=1; i&lt;nh+&gt;&lt;br /&gt;  cerr &lt;&lt; h[i] &lt;&lt; " ";&lt;br /&gt; cerr &lt;&lt; endl;*/&lt;br /&gt; for (int i=0; i&lt;hh;&gt;&lt;br /&gt;  cerr &lt;&lt; t[i] &lt;&lt; " ";&lt;br /&gt; cerr &lt;&lt; endl;&lt;br /&gt; while(nh)&lt;br /&gt;  cerr &lt;&lt; extract_min () &lt;&lt; " ";&lt;br /&gt; cerr &lt;&lt; endl;&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;copy the code above&lt;br /&gt;The end of the c sample program&lt;br /&gt;for  more samples see other posts in the blog&lt;br /&gt;  please leave messages and comment below&lt;br /&gt;&lt;/hh;&gt;&lt;/nh+&gt;&lt;/int&gt;&lt;/vector&gt;&lt;/algorithm&gt;&lt;/iostream&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-77049718215918478?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/77049718215918478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/c-samples-program.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/77049718215918478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/77049718215918478'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/c-samples-program.html' title='c samples program'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-3474101483806286170</id><published>2009-07-08T07:36:00.000-07:00</published><updated>2009-07-08T10:08:38.597-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='conclusion'/><category scheme='http://www.blogger.com/atom/ns#' term='suffering'/><category scheme='http://www.blogger.com/atom/ns#' term='definition'/><category scheme='http://www.blogger.com/atom/ns#' term='history'/><category scheme='http://www.blogger.com/atom/ns#' term='cpr'/><category scheme='http://www.blogger.com/atom/ns#' term='essay'/><title type='text'>history of cpr and definition essay</title><content type='html'>History of cpr and definition&lt;br /&gt;&lt;br /&gt;&lt;div  style="text-align: center;font-family:trebuchet ms;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style=";font-family:arial;font-size:180%;"  &gt;Definition&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="text-align: left;font-family:times new roman;"&gt;&lt;span style="font-size:130%;"&gt; &lt;span style="font-size:100%;"&gt;which is cardiopulmonary resuscitation, is a technique that is used as a life saving skill that helps keep someone who is suffering from cardiac arrest alive long enough to get to the hospital for treatment.  This first aid skill had started to become available in the early 18th century and it was turned into an effective life saving method in the 20th century. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-family:verdana;"&gt;History&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:verdana;"&gt;      &lt;span style="font-family:times new roman;"&gt;The first time CPR was heard of, was in a biblical story about the prophet Elijah.  The story mentioned that Elijah was involved in bringing a child back to life.  It tells of a mother who brought her child to Elijah.  The child was so sick that he was not breathing and the woman asked Elijah for help.  He carried the boy to a bed and prayed to the Lord.  While doing this he stretched out himself on top of the boy three times.  Then, the Lord heard Elijah’s voice and the boy came back to life.  There is also another biblical story about the disciple of Elijah, Elisha.  In this story, Elisha places himself over a boy with his mouth on his mouth, his eyes on his eyes, and his hands on his hands.  The boys body became warm and he stepped down, walked up and down the room, then he got on top of the boy and bent over him.  At this point, the boy sneezed seven times and he awakened and opened his eyes.  It is said that the weight of Elisha compressed the child’s chest and that Elisha’s beard tickled the boys nose which caused him to sneeze.  This was also known as the origin to the phrase, God bless you.  In the early ages, different techniques were adopted that were the first attempts at resuscitation.  One method was the Flagellation Method that was used in the Early Ages.  This method involved a person actually whipping the victim to try and stimulate some type of response.  Another method that was used was the Inversion Method.  This was used in 1770.  This method involved hanging the victim from his feet, with chest pressure to aid in exhaling and pressure release to help with inhaling.  This technique was used in Egypt for 3,500 years and became popular in Europe.  Another method was the Barrel Method that was used in 1773.  This method involved the use of a wooden barrel to force air in and out of the victim’s chest.  A person would put the victim on the barrel and roll him or her back and forth which would result in forcing air in and out of the chest cavity.  One more method that was unique is the Trotting Horse Method.  This was used in 1812 by lifeguards that had horses.  They would rescue the victim, then place them on top of the horse and run the horse up and down the beach.  This was suppose to result in an alternate compression and relaxation of the chest cavity from the bouncing of the body on the horse.  This technique was banned in the United States in1815 because of several complaints from the Citizens for Clean Beaches.  Some highlights in history on CPR are:  In 1740, the Paris Academy of Sciences officially recommended mouth-to-mouth resuscitation for drowning victims.  In 1891, Dr. Friedrich Maass performed the first equivocally documented chest compression in humans.  In 1903, Dr. George Crile reported the first successful use of external chest compressions in human resuscitation and in 1904, he performed the first American case of closed-chest cardiac massage.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;      In the 18th century, the first city to teach and promote resuscitation was Amsterdam.  In August of 1767, the Society for Recovery of Drowned Persons formed and it was the first organized effort to respond to sudden death.  Their methods to stimulate the body involved several techniques.  They recommended to first warm the victim, positioning the victim’s head lower than feet to remove water, applying pressure to the abdomen.  Next they recommended respiration into the victim’s mouth, tickling the victim’s throat, stimulating the victim with rectal and oral fumigation using tobacco smoke, then last, bloodletting.  The first four techniques are still in use today.  Some highlights in history are:  in 1956, Peter Safar and James Elam invented mouth to mouth resuscitation.  In 1957, the U.S. Military adopted the method to revive unresponsive victims.  In 1960, CPR was developed.  In 1972, Leonard Cobb held the worlds first mass citizen training in CPR in Seattle, Washington that was called Medic 2.  He helped in the training of over 100.000 people the first two years of the programs.&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:130%;"  &gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style=";font-family:georgia;font-size:180%;"  &gt;Conclusion &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span style="font-size:100%;"&gt; In conclusion, all of the people who used different CPR techniques had one goal, and that was to save a persons life.  CPR techniques have changed and have come a long was since the Early Ages and techniques keep on changing and improving until this day.  CPR is an important part of first aid skills and it will continue to save thousands of lives each year.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div  style="text-align: center;font-family:trebuchet ms;"&gt;&lt;span style="font-size:180%;"&gt;References&lt;br /&gt;&lt;/span&gt;&lt;div  style="text-align: left;font-family:times new roman;"&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;Works Cited&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;for more info  and practice&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;History of CPR. Wikipedia, The Free Encyclopedia. 6 April. 2008.  http://en.wikipedia.org/wiki/History_of_CPR&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;History of CPR. UKDivers. 6 April. 2008. http://www.ukdivers.net/history/cpr.htm&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;History of CPR. American Hear Association. 6 April. 2008.  &lt;http: org="" identifier="3012990"&gt; &lt;/http:&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-3474101483806286170?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/3474101483806286170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/history-of-cpr-and-definition-essay.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3474101483806286170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3474101483806286170'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/history-of-cpr-and-definition-essay.html' title='history of cpr and definition essay'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-5476801352984734015</id><published>2009-07-03T13:22:00.000-07:00</published><updated>2009-07-03T13:33:19.803-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='statement'/><category scheme='http://www.blogger.com/atom/ns#' term='university'/><category scheme='http://www.blogger.com/atom/ns#' term='purpose'/><category scheme='http://www.blogger.com/atom/ns#' term='sop'/><category scheme='http://www.blogger.com/atom/ns#' term='of'/><title type='text'>sop Samples</title><content type='html'>&lt;span style="color: rgb(51, 0, 51);"&gt;This  statement of purpose sample not   standard operating procedure&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;This SOP statement of purpose sample is written for the admission of university is given to you  to write  your own copy&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;This describes why you want to join the university &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;Name:   Your name&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;Field:  Masters in Computer Science&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;Semester Applied: Spring 2002&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;________________________________________________________________________&lt;br /&gt;&lt;br /&gt;     Most of the achievers irrespective of their field of excellence, whether, musicians, politicians or managers would certify that they had dream, and that they had pursued their goals relentlessly. My aspiration to climb the ladder is based on the similar lines.&lt;br /&gt;&lt;br /&gt;     The role of computers in our day to day life has acquired prominence beyond imagination. Computers have virtually invaded every part of our lives and their far-reaching implications need no explanations. The role of computers in diverse fields is spellbinding. The various software developed has grown to meet the demands of almost any kind of user. Yet, there are more surprises to follow.&lt;br /&gt;&lt;br /&gt;     Thus, in this complex world of continuous development, computers in particular, it is imperative to be competitive and one’s academic qualifications should commensurate with ones imperious skills and concepts.&lt;br /&gt;&lt;br /&gt;Hence my goal of becoming a Masters in Computer Science in indicated.&lt;br /&gt;&lt;br /&gt;     The zeal and determination to purse and explore the field of computer is reflected from my previous qualifications. I have completed my Bachelor Degree in Engineering from Gulbarga University, Karnataka, India, in the field of Computer Science securing a first class with distinction. During the course of my study, we dealt with a wide verity of subjects, mostly on the fundamental aspects of each subject.&lt;br /&gt;&lt;br /&gt;     An advanced degree in Computer Science will be the line of demarcation of my pursuit for academic excellence. I am sure that it will give me the right impetus and required acumen for reaching the pinnacle of my career in future. And, of course, nothing can be more honorable then to be a part of your esteemed institute, the benefits of which I shall ream and relish in my career ahead.&lt;br /&gt;&lt;br /&gt;     I am highly motivated, excited with enthusiasm and desirous to join for further studies in your institution, which is the path leading to my goal. I know, given a chance I will be able to learn, apply and contribute to the mankind using computer science and thereby achieve my long-standing ambitions.&lt;br /&gt;&lt;br /&gt;I look forward to a happy and everlasting association with your famed institution.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;your name&lt;br /&gt;&lt;br /&gt;I hope that this helped you in writing it&lt;br /&gt;I will try to provide more samples Thanks for reading this SOP statement of purpose&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-5476801352984734015?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/5476801352984734015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/sop-samples.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5476801352984734015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5476801352984734015'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/07/sop-samples.html' title='sop Samples'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6253540464534675351</id><published>2009-06-27T12:18:00.000-07:00</published><updated>2009-06-27T12:21:52.370-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='false'/><category scheme='http://www.blogger.com/atom/ns#' term='biology'/><category scheme='http://www.blogger.com/atom/ns#' term='True'/><category scheme='http://www.blogger.com/atom/ns#' term='questions'/><title type='text'>True False biology  questions</title><content type='html'>&lt;span style="font-weight: bold; font-family: courier new;font-size:130%;" &gt;True False biology questions &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;Write A if true and Write B if False &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___The Origin of Species was published soon after the H.M.S. Beagle returned to England.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___The major difference between Darwin and Wallace's views on evolution focused on the relative importance of natural selection as an evolutionary force.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___The "New Synthesis" or "Modern Synthesis" refers to the merging of mutation theory with Darwinian natural selection in the early 1900's.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Mendelian principles of genetics explain all the sources of heritable variations in natural populations of  organisms.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Linked gene refers to movement of alleles.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Linkage of gene  and crossing-over tend to accelerate evolutionary change.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Individual organisms do not evolve&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___In order to avoid offending religious leaders of the time, Darwin was very careful not to mention "special creation" or the "Creator" in his book.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Gregor Mendel ("The Father of Genetics) had the opportunity to read Darwin's writings, but Darwin was unaware of Mendel's genetic discoveries.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___For evolution to occur, changes must be heritable&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Evolution is second only to genetics as "the central organizing principle in all of biology"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Dispersal of an individual from one population to another does not necessarily result in gene flow.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Charles Darwin was unaware of Alfred Russel ___Wallace's studies until long after the voyage of the Beagle.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___Charles Darwin believed that natural selection was a very powerful force and that every part of an organism was "designed" by natural selection to serve a particular purpose.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;___"Point" or "gene" mutations are mutations that occur at weak points in chromosomes. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;End of biology questions&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6253540464534675351?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6253540464534675351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/06/true-false-biology-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6253540464534675351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6253540464534675351'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/06/true-false-biology-questions.html' title='True False biology  questions'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6896703676985474048</id><published>2009-06-24T06:04:00.000-07:00</published><updated>2009-07-05T13:19:24.791-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='biology'/><category scheme='http://www.blogger.com/atom/ns#' term='multiple'/><category scheme='http://www.blogger.com/atom/ns#' term='process'/><category scheme='http://www.blogger.com/atom/ns#' term='choice'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><category scheme='http://www.blogger.com/atom/ns#' term='hydrogen'/><title type='text'>biology multiple choice test</title><content type='html'>&lt;span style=";font-family:verdana;font-size:130%;"  &gt;In this Biology multiple choice test&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;CHOOSE THE BEST ANSWER. Write only the corresponding letter of your choice on the answer sheet.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1_ What causes water molecules to adhere and cohere to each other to form a column when poured?      &lt;br /&gt;1. polarity &lt;br /&gt;     2. hydrogen bonding &lt;br /&gt;     3. covalent bonding    &lt;br /&gt;  4. neutral charges      &lt;br /&gt;5. all of the above &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 2. The epidermis of a green stem of an herbaceous plant contains numerous small green spheres called         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;1. chloroplasts  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       2. mitochondria   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      3. guard cells        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 4. nuclei      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   5. vacuole&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  3. The process by which chloroplasts moving about the perimeter of a live cell is termed &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        1. vibrating cells     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    2. cyclosis or cytoplasmic streaming      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   3. high power magnification      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   4. epidermal streaming        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 5. photosynthesis&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  4. Which of the following processes you used for separation of organelles in carrot root cells?       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  1. filtration  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       2. centrifugation   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      3. grinding and homogenization   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      4. staining      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   5. A, B, and C are correct  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 5. Which of the following can be observed in the sediment after filtration of ground carrot root with sucrose-buffer solution       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  1. whole or fragmented cells         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;2. starch grains       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  3. vessel elements      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   4. oxalate crystals        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 5. all of the above&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  6. What was the purpose of adding iodine potassium iodide (I2KI) when you examined carrot cells?      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   1. to stain the cell walls        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 2. to stain the starch granules       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  3. to separate the chloroplasts       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  4. to separate the chromoplasts      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   5. to precipitate the organelles&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  7. After centrifugation of homogenized carrot roots, the orange-tinted liquid on top is termed  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       1. sediment      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   2. residue     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    3. supernatant       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  4. filtrate       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  5. cytosol&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  8. Different cellular materials/organelles are present after filtration and centrifugation because cellular parts vary in     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    1. density      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   2. sizes         3. solubility&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;         4. all of the above    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     5. both A and B only&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  9. Carrot roots homogenized and centrifuged with sucrose-buffer solution  produce colored supernatant although chromoplasts remain intact because carrot cells  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       1. have cytoplasmic orange pigments  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       2. have water- soluble carotenoid pigments     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    3. have cytosol that is colored orange        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 4. have orange cell walls         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;5. have chromoplasts that do not settle&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 10. What two structures are shown by pith cells of the stem when observed under a compound microscope?       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  1. cell wall and nucleus      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   2. cell wall and mitochondria         &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;3. cell wall and chloroplasts     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    4. cell wall and chromoplasts      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   5. cell wall and cytoplasm&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt; 11. When a glass rod is rubbed with a piece of cloth and placed near a stream of water,  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;       1. water stream repels it       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  2. water stream stops &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;        3. water stream is attracted to it    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     4. water stream flow hastens of slows down    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     5. glass rod is charged&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 12. Which is the correct structural formula of water illustrating its polarity?        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 1. H2O        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 2. O-&lt;br /&gt;&lt;br /&gt;          H   H&lt;br /&gt;&lt;br /&gt;        3. H - O- H       &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;  4. O – H – O      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   5. H+&lt;br /&gt;&lt;br /&gt;          O  O&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 13. A drop of water compared to a drop of ethyl alcohol, water has     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    1. higher elevation        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 2. higher rate of evaporation      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   3. lesser diameter    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;     4. smooth margin     &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;    5. all of the above except B&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 14. What causes water molecules to adhere and cohere to each other to form a column when poured?        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 1. polarity   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      2. hydrogen bonding   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;      3. covalent bonding      &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;   4. neutral charges        &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt; 5. all of the above&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;More of biology multiple choice is comming see all the posts for more&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/116160914/395f6925/biologyquizzes.html"&gt;Download&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6896703676985474048?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6896703676985474048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/06/biology-multiple-choice-test.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6896703676985474048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6896703676985474048'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/06/biology-multiple-choice-test.html' title='biology multiple choice test'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-5656165088128716196</id><published>2009-05-25T13:28:00.000-07:00</published><updated>2009-05-25T13:33:28.869-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='setw'/><category scheme='http://www.blogger.com/atom/ns#' term='vc++'/><title type='text'>setw example</title><content type='html'>In this vc++   set example&lt;br /&gt;&lt;br /&gt;start new cpp file and name it fano&lt;br /&gt;&lt;br /&gt;copy the code below  and see the output&lt;br /&gt;&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;iomanip&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;int main () {&lt;br /&gt;&lt;br /&gt;   int  Numa =  1234567890 ;&lt;/iomanip&gt;&lt;/iostream&gt;&lt;br /&gt;&lt;iostream&gt;&lt;iomanip&gt;    int NumB  = 5432 ;int NumC =2324234 ;&lt;br /&gt;   cout &lt;&lt; "Numa = "  &lt;&lt;&gt;&lt;&lt;endl&gt;&lt;br /&gt;   cout &lt;&lt; "Numa = "  &lt;&lt;&gt;&lt;&lt;endl&gt;&lt;br /&gt;&lt;&lt; numb  ="\n"&gt;&lt;&lt;numb&gt;&lt;&lt; endl ;&lt;br /&gt;   cout&lt;&lt;  "  NumC\n " &lt;&lt;setw(39)&gt;&lt;&lt;numc&gt;&lt;&lt;endl&gt;&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/endl&gt;&lt;/numc&gt;&lt;/setw(39)&gt;&lt;/numb&gt;&lt;/setw(6)&gt;&lt;/endl&gt;&lt;/numa&gt;&lt;/endl&gt;&lt;/numa&gt;&lt;/iomanip&gt;&lt;/iostream&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShsATEstGMI/AAAAAAAAAH4/oudxOGCehEc/s1600-h/SetW_example_c%2B%2B.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 171px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShsATEstGMI/AAAAAAAAAH4/oudxOGCehEc/s320/SetW_example_c%2B%2B.JPG" alt="" id="BLOGGER_PHOTO_ID_5339862110856616130" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; set different value in the function and see the outcome&lt;br /&gt;&lt;br /&gt; This is compiled using VC++ 6 compiler&lt;br /&gt;&lt;br /&gt;try different ones&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-5656165088128716196?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/5656165088128716196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/setw-example.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5656165088128716196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5656165088128716196'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/setw-example.html' title='setw example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_VbplSiPqRyo/ShsATEstGMI/AAAAAAAAAH4/oudxOGCehEc/s72-c/SetW_example_c%2B%2B.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6756325040573411224</id><published>2009-05-21T12:58:00.000-07:00</published><updated>2009-05-26T07:14:21.198-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='celcius'/><category scheme='http://www.blogger.com/atom/ns#' term='dll'/><title type='text'>c++ dll example</title><content type='html'>In this  c++ dll example  we used a dlll to perform simple mathematical operation   which is to convert from Celsius to Fahrenheit and vice versa&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShW4gUh-aRI/AAAAAAAAAHg/1c0QHI2PyMU/s1600-h/dll_fehrenhite_celcius_c%2B%2B.JPG"&gt;&lt;img style="cursor: pointer; width: 302px; height: 176px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShW4gUh-aRI/AAAAAAAAAHg/1c0QHI2PyMU/s320/dll_fehrenhite_celcius_c%2B%2B.JPG" alt="" id="BLOGGER_PHOTO_ID_5338375798724126994" border="0" /&gt;  &lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShW4sABzhpI/AAAAAAAAAHo/0fJiRfXTZSI/s1600-h/dll_converter_celcius.JPG"&gt;&lt;img style="cursor: pointer; width: 315px; height: 171px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShW4sABzhpI/AAAAAAAAAHo/0fJiRfXTZSI/s320/dll_converter_celcius.JPG" alt="" id="BLOGGER_PHOTO_ID_5338375999378917010" border="0" /&gt; &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first step is creating the dll&lt;br /&gt;1 - Start new  Win32 Dynamic link library and name it famo    chose &lt;span style="font-weight: bold;"&gt;simple dll project&lt;/span&gt; the middle one&lt;br /&gt;2- Open the code   and add the following&lt;br /&gt;_&lt;span style="color: rgb(102, 0, 0);font-family:trebuchet ms;" &gt;_declspec(dllexport)void Fehrenhite_Celcius_converter(int n_operation, double input , double &amp;amp;result) ;&lt;/span&gt;&lt;br /&gt;// we used reference here since we want to change the value of output inside the function&lt;br /&gt;below&lt;span style="font-weight: bold;"&gt;  #include "stdafx.h"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and at the buttom&lt;br /&gt;add the following&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void Fehrenhite_Celcius_converter(int n_operation, double input , double &amp;amp;result)&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;{&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; switch (n_operation) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;case   0 :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;result=  1.8 * input +32 ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;        break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;         &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    case  1 :&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;result = (       ( double)     5/  (double) 9) * (input -32) ;&lt;/span&gt;&lt;br /&gt;break ;&lt;br /&gt;}&lt;br /&gt;// casting needed  here bec 5/9 is considered  0&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;      break ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;compile the dlll&lt;br /&gt;&lt;br /&gt;Now  start new MFC name it mydll_program  dialog application   and chose not to select the    about box    and name iy   Celcius_Fehrenhite converter&lt;br /&gt;&lt;br /&gt;3- Add the 2 static controls and 2   Edit controls    a button ,  group box and    2 radio buttons  as  shown above&lt;br /&gt;&lt;br /&gt;In the group box   name it converting  and in the static  boxes  in the properties chose caption input  and for the second one chose caption output&lt;br /&gt;&lt;br /&gt;Add member variables in the class wizards   m_input  for the first edit box and m_outputs  for the second edit box both of type CString&lt;br /&gt;Add a variable of type int integer for the first radio button         m_operation&lt;br /&gt;in the properties chose group&lt;br /&gt;&lt;br /&gt;4- after compiling the dlls  copy the lib and dll to dialog directory&lt;br /&gt;&lt;br /&gt;5- In the project menu   Add to projects then chose files   as shown here&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/ShW9zVEIqtI/AAAAAAAAAHw/rTFfXTvYwzA/s1600-h/Dll_conversion_c%2B%2B.bmp"&gt;&lt;img style="cursor: pointer; width: 320px; height: 215px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/ShW9zVEIqtI/AAAAAAAAAHw/rTFfXTvYwzA/s320/Dll_conversion_c%2B%2B.bmp" alt="" id="BLOGGER_PHOTO_ID_5338381622843058898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the class wizard  add member function for the calculate button and name it  On_Conversion or anything&lt;br /&gt;&lt;br /&gt;Add the following line at the top of the dialog class&lt;br /&gt;__declspec(dllimport)void Fehrenhite_Celcius_converter(int n_operation, double input , double &amp;amp;result) ;&lt;br /&gt;To include the dlls&lt;br /&gt;&lt;br /&gt;put in the On_Conversion add follows&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void CMydll_programDlg::On_Conversion()&lt;br /&gt;{&lt;br /&gt;UpdateData();&lt;br /&gt;double  inputs , outputs ;&lt;br /&gt;inputs = atof(m_input);&lt;br /&gt;// temperature input&lt;br /&gt;Fehrenhite_Celcius_converter(m_operation , inputs ,outputs) ;&lt;br /&gt;// m_operation represents the type of conversion&lt;br /&gt;m_outputs.Format("%2.3f", outputs);&lt;br /&gt;UpdateData(FALSE);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;build and compile your program&lt;br /&gt;&lt;br /&gt;This lesson teaches you how to make simple static dll application  for more see other links in the blog&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6756325040573411224?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6756325040573411224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/c-dll-example.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6756325040573411224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6756325040573411224'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/c-dll-example.html' title='c++ dll example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_VbplSiPqRyo/ShW4gUh-aRI/AAAAAAAAAHg/1c0QHI2PyMU/s72-c/dll_fehrenhite_celcius_c%2B%2B.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-7030471089836346617</id><published>2009-05-19T02:43:00.000-07:00</published><updated>2009-05-19T12:21:46.234-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='MFC'/><category scheme='http://www.blogger.com/atom/ns#' term='dual action'/><category scheme='http://www.blogger.com/atom/ns#' term='button'/><title type='text'>double action mfc c++ button</title><content type='html'>&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKw46kzbsI/AAAAAAAAAGw/1QlTXtLtWYM/s1600-h/bitmap1.bmp"&gt;&lt;img style="cursor: pointer; width: 48px; height: 48px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKw46kzbsI/AAAAAAAAAGw/1QlTXtLtWYM/s320/bitmap1.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523000230244034" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;in this  double action mfc c++ button  tutorial we  created  twofold hover button    with 2 tooltips&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Depending on the location  of the mouse cursor        it performs  different action whether it is addition or   subtraction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/ShKB_E9fBnI/AAAAAAAAAGg/wlpG0uBSJ4M/s1600-h/dualactionADD.bmp"&gt;&lt;img style="cursor: pointer; width: 318px; height: 171px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/ShKB_E9fBnI/AAAAAAAAAGg/wlpG0uBSJ4M/s320/dualactionADD.bmp" alt="" id="BLOGGER_PHOTO_ID_5337471429050828402" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKCeW3dIDI/AAAAAAAAAGo/jOFCrgLRbBs/s1600-h/dual_functions_subtract.bmp"&gt;&lt;img style="cursor: pointer; width: 319px; height: 202px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKCeW3dIDI/AAAAAAAAAGo/jOFCrgLRbBs/s320/dual_functions_subtract.bmp" alt="" id="BLOGGER_PHOTO_ID_5337471966433321010" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;DOWLOADS&lt;br /&gt;&lt;br /&gt;This tutorial use reflected message to handle the onclicked  message since it is a custom control the mouse clicked can not be handled in the dialog class&lt;br /&gt;&lt;br /&gt;It is the hardest example I have ever made&lt;br /&gt;&lt;br /&gt;To start the application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1- Start new MFC exe application and name it Hashi or else accept default settings&lt;br /&gt;2- In the resource View make  add the following bitmaps&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKxB9eDvxI/AAAAAAAAAG4/7dFKhN8yFVY/s1600-h/bmp00001.bmp"&gt;&lt;img style="cursor: pointer; width: 200px; height: 60px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKxB9eDvxI/AAAAAAAAAG4/7dFKhN8yFVY/s320/bmp00001.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523155626082066" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/ShKxGurbF7I/AAAAAAAAAHA/Mei4JFwEV1M/s1600-h/bmp00002.bmp"&gt;&lt;img style="cursor: pointer; width: 200px; height: 60px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/ShKxGurbF7I/AAAAAAAAAHA/Mei4JFwEV1M/s320/bmp00002.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523237554952114" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKxZJL64fI/AAAAAAAAAHY/Y7WZyoirVWk/s1600-h/bmp00005.bmp"&gt;&lt;img style="cursor: pointer; width: 200px; height: 60px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/ShKxZJL64fI/AAAAAAAAAHY/Y7WZyoirVWk/s320/bmp00005.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523553908220402" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/ShKxRdm-SUI/AAAAAAAAAHQ/Il1A9AQRMcs/s1600-h/bmp00004.bmp"&gt;&lt;img style="cursor: pointer; width: 200px; height: 60px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/ShKxRdm-SUI/AAAAAAAAAHQ/Il1A9AQRMcs/s320/bmp00004.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523421951445314" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/ShKxMimfMXI/AAAAAAAAAHI/jY91mnndkKw/s1600-h/bmp00003.bmp"&gt;&lt;img style="cursor: pointer; width: 200px; height: 60px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/ShKxMimfMXI/AAAAAAAAAHI/jY91mnndkKw/s320/bmp00003.bmp" alt="" id="BLOGGER_PHOTO_ID_5337523337392238962" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;and name them as  IDB_BITMAP_PLUS_DOWN , IDB_MINUS_HOVER , IDB_MINUS_DOWN , IDB_LUS_HOVER ,IDB_BITMAP_PLUS_DOWN  in order ;&lt;br /&gt;make of dimension 200 ,60 pixels  do u better if you have&lt;br /&gt;&lt;br /&gt;3- Insert new class from insert menu   and name it  C_Double_task  derived from CButton&lt;br /&gt;4-Add the following data members&lt;br /&gt;CBitmap m_bmp_normal_pic  ,m_bmp_subtract_hover ,m_bitmap_subtract_down,m_bt_addition_hover ,m_bmp_addition_pushed;&lt;br /&gt;enum Btn_Condition{ NORMAL ,MINUS_HOVER ,MINUS_DOWN,PLUS_OVER,PLUS_DOWN} ;&lt;br /&gt;Btn_Condition  m_previous_Mode ,m_present_mode ;&lt;br /&gt;// five bitmaps and enumerators for statuses&lt;br /&gt;&lt;br /&gt;5&lt;span style="color: rgb(102, 0, 0);"&gt;-Add new constructor  ( five parameters ) as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;C_Double_Task::C_Double_Task(int nornel, int negative_over, int neg_dowm, int plus_hovrt, int plus_pressed)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =NORMAL ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_bmp_normal_pic.LoadBitmap(nornel) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_bmp_subtract_hover.LoadBitmap(negative_over) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_bitmap_subtract_down.LoadBitmap(neg_dowm) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_bt_addition_hover.LoadBitmap(plus_hovrt);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_bmp_addition_pushed.LoadBitmap(plus_pressed) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;// loading pictures&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5-Add the following message handlers and  virtual functions&lt;br /&gt;&lt;br /&gt;first with DrawItem virtual function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;void C_Double_Task::DrawItem(LPDRAWITEMSTRUCT lp_Draw_Items_Struct) &lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;CDC *pMyDC =CDC::FromHandle(lp_Draw_Items_Struct-&gt;hDC);&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;   &lt;br /&gt;CDC memDC_item ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;memDC_item.CreateCompatibleDC(pMyDC);&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;CBitmap*  p_bitmap_mfc ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="color: rgb(153, 0, 0); font-weight: bold;"&gt;switch(m_present_mode)           {&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;&lt;br /&gt;// or use if statements&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;case   NORMAL            :&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;p_bitmap_mfc = memDC_item.SelectObject( &amp;amp;m_bmp_normal_pic);&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;break ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;case MINUS_HOVER                 :&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;p_bitmap_mfc = memDC_item.SelectObject( &amp;amp;m_bmp_subtract_hover);&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;break ;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;case MINUS_DOWN                :&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;p_bitmap_mfc = memDC_item.SelectObject( &amp;amp;m_bitmap_subtract_down);&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;case  PLUS_OVER                             :&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;p_bitmap_mfc = memDC_item.SelectObject( &amp;amp;m_bt_addition_hover);&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;break ;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;case   PLUS_DOWN                    :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;      p_bitmap_mfc = memDC_item.SelectObject( &amp;amp;m_bmp_addition_pushed);&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;    &lt;br /&gt;break ;&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;}&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;pMyDC-&gt;BitBlt( 0,0, lp_Draw_Items_Struct-&gt;rcItem.right -lp_Draw_Items_Struct-&gt;rcItem.left ,lp_Draw_Items_Struct-&gt;rcItem.bottom -lp_Draw_Items_Struct-&gt;rcItem.top ,&amp;amp;memDC_item ,0,0,SRCCOPY);&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;  memDC_item.SelectObject(p_bitmap_mfc) ;&lt;/span&gt; &lt;span style="color: rgb(153, 0, 0);"&gt;  memDC_item.DeleteDC();&lt;/span&gt;   &lt;span style="color: rgb(153, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void C_Double_Task::OnLButtonDown(UINT nFlags, CPoint point)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;SetCapture();&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CRect ButtonRect ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;GetClientRect(ButtonRect) ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_previous_Mode  =m_present_mode ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =PLUS_DOWN ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;if(point.x &gt; ButtonRect.left +ButtonRect.Width()/2                {&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;m_previous_Mode  =m_present_mode ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =MINUS_DOWN ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CButton::OnLButtonDown(nFlags, point);&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void C_Double_Task::OnLButtonUp(UINT nFlags, CPoint point) &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;{&lt;/span&gt;     &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;CRect upRect ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    GetClientRect(upRect) ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;CRect rect_left = upRect ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;  rect_left .right = upRect.right/2 ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;if(PtInRect(upRect,point))                {&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;if(PtInRect(rect_left,point ))             {&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;m_previous_Mode  =m_present_mode ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;m_present_mode =PLUS_OVER ;&lt;br /&gt; ReleaseCapture();&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;     &lt;br /&gt;}&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;     &lt;br /&gt;else&lt;br /&gt; {&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_previous_Mode  =m_present_mode ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =MINUS_HOVER ;&lt;br /&gt;ReleaseCapture();&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;      }&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; &lt;br /&gt;else               {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;            m_previous_Mode  =m_present_mode ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =NORMAL ;&lt;br /&gt;ReleaseCapture();&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CButton::OnLButtonUp(nFlags, point);&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;&lt;span style="font-weight: bold;"&gt;void C_Double_Task::OnMouseMove(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CRect rec_total ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;GetClientRect(rec_total) ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CRect Rec_right  = rec_total ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;Rec_right.left = rec_total.right/2 ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CRect Rct_left = rec_total;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;Rct_left.right =rec_total.right/2 ;&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;if( PtInRect( rec_total ,point )){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;         if( PtInRect( Rec_right ,point )){&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;m_previous_Mode  =m_present_mode ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =MINUS_HOVER ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    &lt;br /&gt;Invalidate(FALSE) ; &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    }&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;        else&lt;br /&gt;{&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    m_previous_Mode  =m_present_mode ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    m_present_mode =PLUS_OVER ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;Invalidate(FALSE) ;&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    }&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;          else if((m_previous_Mode == PLUS_DOWN || m_previous_Mode ==MINUS_DOWN) &amp;amp;&amp;amp; PtInRect(Rec_right ,point)){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;           m_previous_Mode  =m_present_mode ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_present_mode =MINUS_DOWN ;&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;          }&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;          else if((m_previous_Mode == PLUS_DOWN || m_previous_Mode ==MINUS_DOWN) &amp;amp;&amp;amp; PtInRect(Rct_left ,point)){&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;             m_previous_Mode  =m_present_mode ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    m_present_mode =PLUS_DOWN ; &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;          }&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;          else{&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; m_previous_Mode  =m_present_mode ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    m_present_mode =NORMAL ; Invalidate(FALSE) ; &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;          }&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;TRACKMOUSEEVENT  tn_Events ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;tn_Events.cbSize =sizeof(TRACKMOUSEEVENT) ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;tn_Events.dwFlags = TME_LEAVE ; &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;tn_Events.hwndTrack=  m_hWnd ;&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;_TrackMouseEvent(&amp;amp;tn_Events) ;&lt;/span&gt;   &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;CButton::OnMouseMove(nFlags, point);&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0); font-weight: bold;"&gt;void C_Double_Task::OnMouseLeave()&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;m_previous_Mode  =m_present_mode ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    m_present_mode =NORMAL ;&lt;br /&gt; Invalidate() ; &lt;/span&gt;     &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and finally  add   onclicked&lt;br /&gt;  afx_msg void OnClicked(); in class header file&lt;br /&gt;&lt;br /&gt;  ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)&lt;br /&gt;&lt;br /&gt;i&lt;span style="color: rgb(102, 0, 0);"&gt;n the begin message map section &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; and add this to  your cpp file&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;void C_Double_Task::OnClicked() &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;    DWORD dwpos = GetMessagePos() ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;   &lt;br /&gt;CPoint pt ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;pt.x  =  LOWORD(dwpos );&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    pt.y = HIWORD(dwpos) ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CRect  client_rectangle ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;GetClientRect(    client_rectangle) ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CString  strA , strB ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;double db_a ,db_b ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;GetParent()-&gt;GetDlgItemText(IDC_NUM1,strA) ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;     GetParent()-&gt;GetDlgItemText(IDC_NUM2,strB) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;     db_a =  atof(strA);&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;db_b=  atof(strB);&lt;br /&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;double result ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;result =   db_b + db_a ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    &lt;br /&gt;CRect  leftRect ;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;     leftRect = client_rectangle ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;leftRect.right = client_rectangle .left +client_rectangle.Width()/2;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;if(leftRect.PtInRect(pt))&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; result =   db_b - db_a ;&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;CString Str_result ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;     Str_result.Format("%3.2f",result);&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;GetParent()-&gt;SendMessage(UDM_REGION_CLICKED, result);&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;lastly add this to your class header ;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;static const UINT UDM_REGION_CLICKED = ::RegisterWindowMessage(_T("UDM_REGION_CLICKED-{23C118F8-01}"));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;now we finished  with the custom class Derived from Cbutton &lt;br /&gt;&lt;br /&gt;Now  we are in  the dialog class&lt;br /&gt;6-  In the class wizard add  the following data member&lt;br /&gt;7-     edit the constructor as follows&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;CHashiDlg::CHashiDlg(CWnd* pParent /*=NULL*/)&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    : CDialog(CHashiDlg::IDD, pParent),m_two_actions_botn(IDB_NORMAL ,IDB_MINUS_HOVER ,IDB_MINUS_DOWN , IDB_LUS_HOVER , IDB_BITMAP_PLUS_DOWN)&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;{&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    //{{AFX_DATA_INIT(CHashiDlg)&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    m_numB = _T("");&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    //}}AFX_DATA_INIT&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;// Note that LoadIcon does not require a subsequent DestroyIcon in Win32&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;    m_hIcon = AfxGetApp()-&gt;LoadIcon(IDR_MAINFRAME);&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8-as  pretranslate message handler as follows&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;C_Double_Task    m_two_actions_botn;&lt;/span&gt;&lt;br /&gt;and     for  edit controls add member variable  with names like   m_numA , m_numB ,m_results    of type string&lt;br /&gt;&lt;br /&gt;in the dialog class header add &lt;span style="color: rgb(102, 0, 0);"&gt;  afx_msg LRESULT OnRegionClicked( WPARAM wParam, LPARAM lParam );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;in the begin message map section in the cpp file  &lt;span style="color: rgb(102, 0, 0);"&gt;ON_REGISTERED_MESSAGE(UDM_REGION_CLICKED, OnRegionClicked)&lt;/span&gt;&lt;br /&gt;and at the end of the cpp   add&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;LRESULT CHashiDlg::OnRegionClicked( WPARAM wParam, LPARAM param )&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;{ &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;CString resl ;&lt;/span&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;&lt;br /&gt;resl.Format("%3.3",wParam);&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;SetDlgItemText( IDC_RESULT , resl) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    return (0);&lt;/span&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;finally build the application and trying clicking on the right half and left half &lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;BOOL CHashiDlg::PreTranslateMessage(MSG* pMsg) &lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;br /&gt;if( m_vc_tooltip.m_hWnd) m_vc_tooltip.RelayEvent(pMsg) ;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);"&gt;return CDialog::PreTranslateMessage(pMsg);&lt;/span&gt;    &lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Note this is a draft    not working&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-7030471089836346617?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/7030471089836346617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/double-action-mfc-c-button.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7030471089836346617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7030471089836346617'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/double-action-mfc-c-button.html' title='double action mfc c++ button'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_VbplSiPqRyo/ShKw46kzbsI/AAAAAAAAAGw/1QlTXtLtWYM/s72-c/bitmap1.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-895125721849228565</id><published>2009-05-09T04:12:00.001-07:00</published><updated>2009-05-09T13:40:26.391-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='control'/><category scheme='http://www.blogger.com/atom/ns#' term='Hover Button'/><category scheme='http://www.blogger.com/atom/ns#' term='two tooltips'/><title type='text'>c++ hover button with two tooltips</title><content type='html'>&lt;span style="color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt;In this c++ hover button with two tooltips tutorial   we create a c++ button control with  two tooltips   one on the left half and the other on the right side&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt;&lt;br /&gt;The tooltips text  on the leftis different from  one on the right and change in&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt; the event of mouse  m&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:courier new;font-size:130%;"  &gt;ove in the  mouse rectangle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;To Get the project along the exe &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:180%;" &gt; &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-size:180%;" &gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:180%;" &gt;&lt;a href="http://www.4shared.com/file/104194764/2a87c3d9/hovebutton.html"&gt;&lt;span style="font-weight: bold;"&gt; click here  &lt;/span&gt; &lt;/a&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;note that exe is in the debug folder&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/SgV_Yhe66oI/AAAAAAAAAF4/wli7cdp1MSA/s1600-h/righttoooltip.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 237px; height: 145px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/SgV_Yhe66oI/AAAAAAAAAF4/wli7cdp1MSA/s320/righttoooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5333809392971868802" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/SgV_Bz0IKMI/AAAAAAAAAFw/dz-MVwg8uYo/s1600-h/lefttooltip.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 303px; height: 179px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SgV_Bz0IKMI/AAAAAAAAAFw/dz-MVwg8uYo/s320/lefttooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5333809002755664066" border="0" /&gt;&lt;/a&gt;With the help of codeproject I made this application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To Create the application&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:times new roman;font-size:130%;"  &gt;1- &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:times new roman;font-size:130%;"  &gt;Start new MFC appWizard( Exe)   Dialog based &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:times new roman;font-size:130%;"  &gt;application and give it a name like Tache  or any other weird name you w&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:times new roman;font-size:130%;"  &gt;ant !!?&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center; color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: rgb(0, 0, 0);font-family:times new roman;font-size:130%;"  &gt;2- &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;In The Resource editor  add the follow images for hover animation                                                   &lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/SgWCubhjPpI/AAAAAAAAAGI/l6T2d3OaPKM/s1600-h/normaltooltip.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 180px; height: 80px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/SgWCubhjPpI/AAAAAAAAAGI/l6T2d3OaPKM/s320/normaltooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5333813067864293010" border="0" /&gt;&lt;/a&gt;&lt;div style="text-align: right;"&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/SgWC2_lXV-I/AAAAAAAAAGQ/6k0KADrH16o/s1600-h/hovertooltip.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 180px; height: 80px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SgWC2_lXV-I/AAAAAAAAAGQ/6k0KADrH16o/s320/hovertooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5333813214982920162" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/SgWC2_lXV-I/AAAAAAAAAGQ/6k0KADrH16o/s1600-h/hovertooltip.JPG"&gt;   &lt;/a&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/SgWDDLDFzvI/AAAAAAAAAGY/9V0Rk8dWH6E/s1600-h/clickedtooltip.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 180px; height: 80px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SgWDDLDFzvI/AAAAAAAAAGY/9V0Rk8dWH6E/s320/clickedtooltip.JPG" alt="" id="BLOGGER_PHOTO_ID_5333813424218820338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; and name them as follows  IDB_NORMAL   ,IDB_OVER  and  IDB_DOWE respectively ( the ids of the bitmaps&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;3-Insert new class in the  insert menu or from class view      and name it CoolButton&lt;/span&gt;&lt;br /&gt;4- Add the following data members to  the newly created class ( public)&lt;br /&gt;  &lt;span style="color: rgb(204, 0, 0);font-family:verdana;" &gt;CBitmap m_bm_Normal ,m_bmp_over ,m_bmp_pushed ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;// three bitmaps   and  status enumerators&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;  &lt;span style="color: rgb(255, 0, 0);"&gt;enum Buttom_status {  NORMAL ,Hoverimage ,CLICKED} ;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    Buttom_status  m_previous_state ,m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;5- Add new constructor in the new class and edit it as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;CoolButton::&lt;span style="font-weight: bold;"&gt;CoolButton&lt;/span&gt;(int regular, int hover, int clicjed)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_current_status = NORMAL ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt; m_bm_Normal.LoadBitmap(regular) ,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;     m_bmp_over.LoadBitmap(hover) ,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;     m_bmp_pushed.LoadBitmap(clicjed) ;&lt;/span&gt;&lt;br /&gt;// associate each variable ( Cbitmap with a bitmap )&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;6- Add the following windows messege handlers and virtual functions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Onleftmousedown , onleftmouseup , onmouse_move  and Drawitem  and edit them as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;void CoolButton::&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);font-family:verdana;" &gt;OnLButtonDown&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_current_status = CLICKED ;&lt;/span&gt;&lt;br /&gt;// now the button is clicked&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;SetCapture();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;    CButton::OnLButtonDown(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;void CoolButton::&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);font-family:verdana;" &gt;OnLButtonUp&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;CRect totals_Rect ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;GetClientRect(totals_Rect) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;if(On_Recto(totals_Rect ,point))  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_current_status = Hoverimage ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;// if  you  release the left button while you are inside the button boundaries&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_current_status = NORMAL  ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;    CButton::OnLButtonUp(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;void CoolButton::&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 0, 0);font-family:verdana;" &gt;OnMouseMove&lt;/span&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     CRect  mybutton_rect ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     GetClientRect(mybutton_rect) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     if(   m_previous_state == CLICKED &amp;amp;&amp;amp; (On_Recto(mybutton_rect ,point)))  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_current_status = CLICKED  ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     else if(On_Recto(mybutton_rect ,point))  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;         &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_current_status = Hoverimage  ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; Invalidate(FALSE) ; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     else &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; m_current_status =    NORMAL  ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; Invalidate(FALSE) ; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; TRACKMOUSEEVENT TME_STRUCT ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; TME_STRUCT.cbSize =  sizeof(TRACKMOUSEEVENT) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; TME_STRUCT.dwFlags = TME_LEAVE ; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; TME_STRUCT.hwndTrack =m_hWnd ; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; _TrackMouseEvent(&amp;amp;TME_STRUCT) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;      &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt;     CButton::OnMouseMove(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 0);font-family:verdana;" &gt; }&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left; color: rgb(51, 0, 0); font-family: verdana;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To draw the button&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void CoolButton::&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(102, 0, 0);"&gt;DrawItem&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;(LPDRAWITEMSTRUCT l_DrawItem_Struct) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;    CDC *pDC_Own  =  CDC::FromHandle(l_DrawItem_Struct-&gt;hDC) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;   CBitmap *pOldBitmap ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;   CDC memi_DC   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;       ; memi_DC.CreateCompatibleDC (pDC_Own) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;switch(m_current_status)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;case NORMAL :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;pOldBitmap =  memi_DC.SelectObject( &amp;amp;m_bm_Normal  ) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;case  Hoverimage :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;pOldBitmap =  memi_DC.SelectObject(&amp;amp; m_bmp_over  ) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;break ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;case CLICKED :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;pOldBitmap =  memi_DC.SelectObject( &amp;amp;m_bmp_pushed  ) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;break ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;pDC_Own-&gt;BitBlt(0,0, l_DrawItem_Struct-&gt;rcItem.right -l_DrawItem_Struct-&gt;rcItem.left ,l_DrawItem_Struct-&gt;rcItem.bottom- l_DrawItem_Struct-&gt;rcItem.top ,&amp;amp;memi_DC ,0,0,SRCCOPY);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;memi_DC.SelectObject(pOldBitmap) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;memi_DC.DeleteDC() ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;7- Add the following functioon to Coolbutton class name it On_Recto of type BOOL edit as follows&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:verdana;" &gt;BOOL CoolButton::On_Recto(CRect &amp;amp;rct, CPoint cpt)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:verdana;" &gt;return(cpt.x&gt; 0 &amp;amp;&amp;amp; cpt.x&lt; (rct.right -rct.left) &amp;amp;&amp;amp; cpt.y&gt;0 &amp;amp;&amp;amp; cpt.y&lt; (rct.bottom -rct.top) )?TRUE :FALSE ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;to check whether the mouse inside the botton rect&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:verdana;" &gt; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;8- Add the following virtual function to the new class of type void&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;void CoolButton::&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;OnMouseLeave&lt;/span&gt;&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;m_previous_state   = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;m_current_status =    NORMAL  ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;Invalidate() ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;and add &lt;span style="color: rgb(102, 0, 0);font-family:arial;" &gt;ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)&lt;/span&gt; inside  begin messege map&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Now we are finished from CoolButton Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;9- In the dialog resource editor set Ok button properties as owner_draw&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;10 Open the class wizard  and add a member variable  chose IDOK in the dialog class and let us name it m_double_tooltip_button or something else       and do not forget to put&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; #include "CoolButton.h" in your dialog class header file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;11- Replace the old constructor in the dialgo class with the following one&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;CTasheDlg::CTasheDlg(): CDialog(IDD_TASHE_DIALOG,NULL), m_double_tooltips_button(IDB_NORMAL ,IDB_OVER ,IDB_DOWE)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;//loading the bitmaps &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;12-&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-size:100%;" &gt; &lt;span style="font-size:130%;"&gt;Add the  CToolTipCtrl variable in  the dialog class and name it like  m_mytooltip  or else&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; add the following code to OnItDialog&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;SetWindowText("helo");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;UpdateData(FALSE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_double_tooltips_button.MoveWindow( 60,60,240,140) ;&lt;/span&gt;&lt;br /&gt;// buton new position&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;CRect  button_rectangle ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_double_tooltips_button.GetClientRect(button_rectangle) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_mytooltip.Create( this);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;CRect leftRect = button_rectangle ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;CRect Right_button  = button_rectangle ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;leftRect.right =  Right_button.left  = button_rectangle.right/2 ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_mytooltip.AddTool(&amp;amp;m_double_tooltips_button, " Right half ", &amp;amp;Right_button ,1) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;m_mytooltip.AddTool(&amp;amp;m_double_tooltips_button, " you are on the left part of the custom control botton",&amp;amp;leftRect ,2) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);font-family:verdana;" &gt;// or you can replace last addtool with  updateTooltip function&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-family: georgia; color: rgb(0, 0, 0);"&gt;13 - In your dialog class add the  PreTranslateMessage messege handler as follows&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;BOOL CTasheDlg::PreTranslateMessage(MSG* pMsg)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    if(m_mytooltip.m_hWnd) m_mytooltip.RelayEvent(pMsg) ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    return CDialog::PreTranslateMessage(pMsg);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;14- Build application compile it and move  the  mouse cursor inside the botton and see the effect of that&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;I hope that you liked this tutorial ( tache) for  more tutorials see the blog for more&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;My next project  would  be A button with 2 functions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;Thanks for reading the tache program  ....&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-895125721849228565?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/895125721849228565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/c-hover-button-with-two-tooltips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/895125721849228565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/895125721849228565'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/05/c-hover-button-with-two-tooltips.html' title='c++ hover button with two tooltips'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VbplSiPqRyo/SgV_Yhe66oI/AAAAAAAAAF4/wli7cdp1MSA/s72-c/righttoooltip.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-5962303432219344705</id><published>2009-04-22T13:11:00.000-07:00</published><updated>2009-05-13T12:05:14.764-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='hpver button'/><category scheme='http://www.blogger.com/atom/ns#' term='two states tasho'/><title type='text'>c++ Hover button with two state images  left and right</title><content type='html'>&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;In this c++ example  hover  button with  two state   images is based on the example&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;http://www.codeproject.com/KB/buttons/Cool_Buttons.aspx in codeproject.com&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;I deleted unnecessary codes    and I added my stuff  to it&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;I could   not use SetStatus function so I wrote it every time  I use it( 2 line functions)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;Every thing that does not make changes I omitted it&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;a style="font-weight: bold;" href="http://www.4shared.com/file/100398120/be5a84d6/tasho.html"&gt;&lt;br /&gt;DOWNLOAD&lt;/a&gt;&lt;/span&gt;  The downloads  contains  complete file plus the exe in the folder of debug&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;The idea  and the theme of this project is to have  a button with two state hover&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;like the one shown in t&lt;/span&gt;&lt;a style="color: rgb(0, 0, 0);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/Se97k6pndHI/AAAAAAAAAEc/0-v0KBkRXcU/s1600-h/LEFT.GIF"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 274px; height: 167px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/Se97k6pndHI/AAAAAAAAAEc/0-v0KBkRXcU/s320/LEFT.GIF" alt="" id="BLOGGER_PHOTO_ID_5327612758351901810" border="0" /&gt;&lt;/a&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;he images below,&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/Se974jRj2HI/AAAAAAAAAEk/stdgt045i7A/s1600-h/RIGHTBUTTON.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 290px; height: 162px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/Se974jRj2HI/AAAAAAAAAEk/stdgt045i7A/s320/RIGHTBUTTON.JPG" alt="" id="BLOGGER_PHOTO_ID_5327613095674370162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;The first image is when the mouse cursor on the right  side and the second one is when the cursor is over the left side&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;These  depend on the location of mouse cursor&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;To expand this project you  can make multifunction  buttons  or double function buttons&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;or multiple hover button  or another thing to add  is    to use 2 tooltips  for a single button&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1-Start  visualc++ project  MFC Application wizard  let name  a weird name tasho or tashi if you like  and Chose  Dialog  and Deselct  about Box and  activeX controls  ( no need for them)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;and deselect   compiler  comments   generated by the compiler&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;2-Rename the Dialog resource ID to  IDD_TASHO_DIALOG&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;3-Add the following bitmap resources to resources  go to resource View and Insert Insert Bitmap&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;and  draw  5 bitmaps  as shown  here&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;a style="color: rgb(0, 0, 0);" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGPpnzk8QI/AAAAAAAAAEw/hFxjq66vDU4/s1600-h/Normal.bmp"&gt;&lt;img style="cursor: pointer; width: 120px; height: 40px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGPpnzk8QI/AAAAAAAAAEw/hFxjq66vDU4/s320/Normal.bmp" alt="" id="BLOGGER_PHOTO_ID_5328197779378729218" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/SfGQgVHi6-I/AAAAAAAAAFA/RzsBMqAg258/s1600-h/left1.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 120px; height: 40px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SfGQgVHi6-I/AAAAAAAAAFA/RzsBMqAg258/s320/left1.bmp" alt="" id="BLOGGER_PHOTO_ID_5328198719255014370" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGRTPS2D0I/AAAAAAAAAFI/6wghV0gyck8/s1600-h/Right1.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 122px; height: 40px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGRTPS2D0I/AAAAAAAAAFI/6wghV0gyck8/s320/Right1.bmp" alt="" id="BLOGGER_PHOTO_ID_5328199593865121602" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;        &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGRqWhVgBI/AAAAAAAAAFQ/M50wJxmcg7M/s1600-h/clicked1.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 122px; height: 40px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SfGRqWhVgBI/AAAAAAAAAFQ/M50wJxmcg7M/s320/clicked1.bmp" alt="" id="BLOGGER_PHOTO_ID_5328199990941941778" border="0" /&gt;&lt;/a&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/SfGSDKEFFoI/AAAAAAAAAFY/UUGMxsoowdI/s1600-h/down2.bmp"&gt;&lt;br /&gt;&lt;/a&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/SfHpHHGbVZI/AAAAAAAAAFo/RH9JschZXAU/s1600-h/down2.bmp"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 122px; height: 40px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SfHpHHGbVZI/AAAAAAAAAFo/RH9JschZXAU/s320/down2.bmp" alt="" id="BLOGGER_PHOTO_ID_5328296142530368914" border="0" /&gt;&lt;/a&gt;  anyway Send me  better if you can&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Make the images of size 40 120&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;chose id for the bitmaps  IDB_NORMAL ,IDB_LEFT ,IDB_RIGHT ,IDB CLICKED ,IDB_DOWN&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;note that IDB CLICKED is currently unused  but it will be used in future programs&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;4- In the insert menu   Insert new class MFC class Chose Cbutton as the base class for it and Name it CCoolButton&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;5- Add the following data members to the   newly created class&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:georgia;" &gt;and make  them public&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:courier new;" &gt;&lt;span style="font-weight: bold;"&gt;CBitmap&lt;/span&gt; m_bmp_normal ,m_bmp_left ,m_bmp_right ,m_bmp_clicked ,m_bmp_down;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:courier new;" &gt;    enum ButtonStatus { NORMAL ,LEFT ,RIGHT ,CLICKED ,DOWN};&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:courier new;" &gt;   &lt;span style="font-weight: bold;"&gt; ButtonStatus &lt;/span&gt; m_old_status ,m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;6-In the newly created class&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Add the following constructor  .  five  elements&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;as follows '&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;CCoolButton::CCoolButton(int nidNormal, int nidleft, int nidright, int nidclicked, int niddown)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_current_status = NORMAL ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_bmp_normal.LoadBitmap(nidNormal);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_bmp_left.LoadBitmap(nidleft);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_bmp_right.LoadBitmap(nidright);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_bmp_clicked.LoadBitmap(nidclicked);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;m_bmp_down.LoadBitmap(niddown);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:verdana;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;7-  Add the 2 windows messege handler and edit them as follows&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;first OnleftbuttonDown&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;void CCoolButton::OnLButtonDown(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_current_status = DOWN ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    SetCapture();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CButton::OnLButtonDown(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;and OnleftbuttonUp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;void CCoolButton::OnLButtonUp(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;CRect totalrect ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;GetClientRect(&amp;amp;totalrect);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;CRect  left =  totalrect;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;left.DeflateRect(60,0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;if( PtInRect(totalrect,point))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    if(PtInRect(left ,point))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_current_status =  RIGHT ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_current_status =  LEFT ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_current_status =  NORMAL ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     ReleaseCapture();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CButton::OnLButtonUp(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; and OnMouseMove as follows &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;void CCoolButton::OnMouseMove(UINT nFlags, CPoint pnt) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;   CRect buttonrect , leftrect ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;GetWindowRect(buttonrect);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt; leftrect = buttonrect;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt; leftrect.DeflateRect(60 ,0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;if  (m_current_status ==DOWN )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt; {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     if( sRect(buttonrect ,pnt ))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         Invalidate(FALSE) ; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     else{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         m_current_status =  CLICKED ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         Invalidate(FALSE) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     else if (m_old_status == DOWN &amp;amp;&amp;amp; (PtInRect(buttonrect,pnt)))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         m_current_status =  DOWN  ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         if(sRect ( buttonrect, pnt ))&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         {if(sRect(leftrect , pnt))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             m_old_status =m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             m_current_status = LEFT ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             Invalidate(FALSE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         m_old_status =m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             m_current_status = RIGHT ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             Invalidate(FALSE);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;              m_old_status =m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             m_current_status = NORMAL  ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;             Invalidate(FALSE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;TRACKMOUSEEVENT tm_Event ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;tm_Event.dwFlags = TME_LEAVE ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;tm_Event.hwndTrack = m_hWnd ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;tm_Event.cbSize =sizeof(TRACKMOUSEEVENT) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;_TrackMouseEvent(&amp;amp; tm_Event );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CButton::OnMouseMove(nFlags, pnt);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;As you can  see   I could not use SetStatus in the original example&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Also  add  the virtual function    DrawItem&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;void CCoolButton::DrawItem(LPDRAWITEMSTRUCT    lp_di_struct) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CDC *DrawDc =   CDC::FromHandle(lp_di_struct-&gt;hDC);       &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CBitmap * pOldBitmap ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    CDC membtmDC ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    membtmDC.CreateCompatibleDC(DrawDc) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    switch( m_current_status) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    case NORMAL :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         pOldBitmap =  membtmDC.SelectObject( &amp;amp; m_bmp_normal) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;         break ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    case LEFT:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    pOldBitmap =  membtmDC.SelectObject(&amp;amp; m_bmp_left);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    case RIGHT :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt; pOldBitmap =  membtmDC.SelectObject(&amp;amp; m_bmp_right);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    case DOWN :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;     pOldBitmap =  membtmDC.SelectObject(&amp;amp; m_bmp_down);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;   &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    case CLICKED :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt; pOldBitmap =  membtmDC.SelectObject(&amp;amp; m_bmp_clicked);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;DrawDc-&gt;BitBlt(0,0, lp_di_struct-&gt;rcItem.right -lp_di_struct-&gt;rcItem.left    ,   lp_di_struct-&gt;rcItem.bottom - lp_di_struct-&gt;rcItem.top , &amp;amp;membtmDC,0,0,SRCCOPY);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    membtmDC.SelectObject(pOldBitmap);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    membtmDC.DeleteDC();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;As you can see it is  almost the same as in the original example   but there is 5 switch statements instead of 3 because we have here 5 bimaps  notice      I altered some names&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Then add new  function and name it     sRect   of type BOOL&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-size:85%;" &gt;BOOL CCoolButton::sRect(CRect &amp;amp;rct, CPoint &amp;amp;pnt)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;return(pnt.x&gt; 0 &amp;amp;&amp;amp; pnt.x&lt; (rct.right -rct.left) &amp;amp;&amp;amp; pnt.y&gt;0 &amp;amp;&amp;amp; pnt.y&lt; (rct.bottom -rct.top) )?TRUE :FALSE ;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;And finally   add  new function OnMouseLeave  and edit as follows&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;void CCoolButton::OnMouseLeave()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_old_status = m_current_status ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    m_current_status =  NORMAL ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;    Invalidate();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;" &gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since this  function is part of CWnd class   add the following to BeginMessageMap&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:arial;" &gt;ON_MESSAGE(WM_MOUSELEAVE,OnMouseLeave)&lt;/span&gt;&lt;br /&gt;under&lt;br /&gt;ON_WM_LBUTTONDOWN()&lt;br /&gt;ON_WM_LBUTTONUP()&lt;br /&gt;ON_WM_MOUSEMOVE()&lt;br /&gt;in ur class cpp file&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;Now we finished   CCoolButton  we move to the   dialog class  CTashoDlg&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;8-In the  dialog resource    make   In the  class wizard  Add member variable  chose the Ok button chose variable type   CCoolButton and let us chose a name for it &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;m_mono &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt;or anything you like   and do not forget to add  &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt; #include "CoolButton.h"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);font-family:trebuchet ms;" &gt; in your dialog class header file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;9-In the InitDialog  Add the following  code snippet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: rgb(102, 0, 0);"&gt; SetWindowText("hiee");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:georgia;" &gt; UpdateData(FALSE);&lt;br /&gt;&lt;/span&gt; &lt;span style="color: rgb(102, 0, 0);font-family:georgia;" &gt;m_mono.MoveWindow( 30,45,150,90);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);font-family:verdana;" &gt;10- Delete   the original constructor and replace it with the following    constructor with no arguments&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);font-family:times new roman;font-size:85%;"  &gt;CTashoDlg::CTashoDlg() :CDialog(IDD_TASHO_DIALOG,NULL), m_mono(IDB_NORMAL ,IDB_LEFT ,IDB_RIGHT ,IDB_CLICKED ,IDB_DOWN)&lt;br /&gt;{&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:verdana;" &gt;11- Build the application and see the result&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:verdana;" &gt;My next project would be   a button with  2 ToolTips one on the left and one on the right   I hope that you enjoyed it and benefited from it /.......&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;for more tutorials  see  other posts in the blog&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 51);font-family:verdana;" &gt;It is hard and I made it loll&lt;br /&gt;&lt;br /&gt;If you have any comment and any ideas you want to share   leave it below :!~&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-5962303432219344705?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/5962303432219344705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/04/visual-c-examples-hover-button-with-two.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5962303432219344705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5962303432219344705'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/04/visual-c-examples-hover-button-with-two.html' title='c++ Hover button with two state images  left and right'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VbplSiPqRyo/Se97k6pndHI/AAAAAAAAAEc/0-v0KBkRXcU/s72-c/LEFT.GIF' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-8645062657173601440</id><published>2009-03-21T03:11:00.000-07:00</published><updated>2009-03-21T03:41:54.321-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CRect'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='visual'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='InflateRect'/><title type='text'>visual C++ Crect InflateRect Example</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_VbplSiPqRyo/ScTAV2_kygI/AAAAAAAAAD8/9R6RrDxndCE/s1600-h/inflatedrect_3.JPG"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 131px; height: 320px;" src="http://2.bp.blogspot.com/_VbplSiPqRyo/ScTAV2_kygI/AAAAAAAAAD8/9R6RrDxndCE/s320/inflatedrect_3.JPG" alt="" id="BLOGGER_PHOTO_ID_5315584941975980546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/ScS_zw-nbsI/AAAAAAAAADs/zRGrL_2Atng/s1600-h/inflaterect_1.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 156px; height: 400px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/ScS_zw-nbsI/AAAAAAAAADs/zRGrL_2Atng/s400/inflaterect_1.JPG" alt="" id="BLOGGER_PHOTO_ID_5315584356245794498" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In this  visual c++ CRect  InflateRect example  We build simple application that enlarge a rectangle and changing color  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/ScS_72vKbZI/AAAAAAAAAD0/aBqR62CkkXY/s1600-h/inflaterect_2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 173px; height: 400px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/ScS_72vKbZI/AAAAAAAAAD0/aBqR62CkkXY/s400/inflaterect_2.JPG" alt="" id="BLOGGER_PHOTO_ID_5315584495230545298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To initiate the move you press inside  the  small rectangle to get irregular enlargement or out side the  rectangle to get  regular inflation and  multiple colors&lt;br /&gt;&lt;br /&gt;To the  Executable file click here  &lt;a href="http://www.4shared.com/file/94109628/34ceb760/inflated_rectangle.html"&gt;InflatidREct_exe&lt;/a&gt; and the complete project  &lt;a href="http://www.4shared.com/file/94109948/69c857db/inflated_rectangle.html"&gt;theproject &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Start Building the  project&lt;br /&gt;&lt;br /&gt;1- Start new MFC exe  single document  and name it like inflated_rect&lt;br /&gt;2 - Add the following   data members to your derived View class  &lt;br /&gt;   &lt;span style="font-family: georgia; color: rgb(255, 0, 0);font-size:78%;" &gt;public:&lt;br /&gt;    CRect m_rect_red ,m_rect_blue ;&lt;br /&gt;    CBrush m_bar_red ,m_br_green ,m_brush_blue ,m_br_orange ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and initiliza  them in Cview constructor as follows&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: verdana;font-size:78%;" &gt;CInflated_rectangleView::CInflated_rectangleView(): m_rect_red(40,40,120,400),m_rect_blue(70,210,90,230),m_bar_red(RGB(99,0,0)),m_br_green(RGB(0,99,0)),m_brush_blue(RGB(0,0,99)),m_br_orange(RGB(0xCC,0x99,33))&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3- Add the  following  messege handlers to   your derived View class  WM_RBUTTONDOWN ,WM_LBUTTONDOWN ,WM_TIMER&lt;br /&gt;&lt;br /&gt;and edit the functions they generate as follows&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;font-size:85%;" &gt;&lt;span style="color: rgb(255, 0, 0);"&gt;void CInflated_rectangleView::OnLButtonDown(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    if(m_rect_blue.PtInRect(point)){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    m_rect_blue.InflateRect(2,5,1,12) ;  // irregular inflation  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;  InvalidateRect(NULL,FALSE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;  else &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;SetTimer(1, 300,NULL) ; CView::OnLButtonDown(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;void CInflated_rectangleView::OnRButtonDown(UINT nFlags, CPoint point) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;{&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;KillTimer(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;    CView::OnRButtonDown(nFlags, point);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-family: times new roman;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and finaly &lt;br /&gt;&lt;span style="font-family: georgia;font-size:85%;" &gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;void CInflated_rectangleView::OnTimer(UINT nIDEvent) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if( m_rect_blue.left&gt;50)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; m_rect_blue.InflateRect(4,1) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;else &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;m_rect_blue.InflateRect(0,5);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if(m_rect_blue.top&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;m_rect_blue.SetRect(70,210,90,230); // return to first siza &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;      &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;InvalidateRect(NULL,TRUE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;  }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4-&lt;br /&gt;&lt;br /&gt;Finally edit t the  ondraw function to as follows \&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;void CInflated_rectangleView::OnDraw(CDC* pDC)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;TextOut(40,15," Press the left key to see the effect amd try to press inside the blue");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;SelectObject( m_bar_red) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;Rectangle( m_rect_red);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;SelectObject(m_brush_blue) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    if(m_rect_blue.left&lt;=45)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;SelectObject ( m_br_green);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    if(m_rect_blue.top  &lt;=120)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;   pDC-&gt;SelectObject( m_br_orange);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;    pDC-&gt;Rectangle( m_rect_blue) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0); font-family: arial;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; and   then build the applications and enjoy it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-8645062657173601440?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/8645062657173601440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/03/visual-c-crect-inflaterect-example.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8645062657173601440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8645062657173601440'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/03/visual-c-crect-inflaterect-example.html' title='visual C++ Crect InflateRect Example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_VbplSiPqRyo/ScTAV2_kygI/AAAAAAAAAD8/9R6RrDxndCE/s72-c/inflatedrect_3.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-4045722577236859778</id><published>2009-03-18T13:37:00.000-07:00</published><updated>2009-05-09T13:38:27.849-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='intersectrect'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='visual'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='selectstockobject'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Visual c++  IntersectRect example tutorial</title><content type='html'>&lt;a href="http://4.bp.blogspot.com/_VbplSiPqRyo/ScFhMxvh17I/AAAAAAAAADk/Vd2nGhLU_pc/s1600-h/intersectionrect2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5314635907412907954" style="margin: 0px auto 10px; display: block; width: 320px; height: 95px; text-align: center;" alt="" src="http://4.bp.blogspot.com/_VbplSiPqRyo/ScFhMxvh17I/AAAAAAAAADk/Vd2nGhLU_pc/s320/intersectionrect2.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this visual c++ IntersectRect Example we will learn how to use the mfc intersection function &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;The intersected rectangle hatched in Red&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;to get the  exefile   &lt;a href="http://www.4shared.com/file/94112979/df839a3f/Intersectrectangle.html"&gt;click here  &lt;/a&gt;and download the file and  get the &lt;a href="http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html"&gt;complete project&lt;/a&gt;  and thinks of additions  you can make&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To start &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;1-&lt;/strong&gt; Start a new project and let us name it IntersectRectangle &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;2-&lt;/strong&gt; chose single document and deselect printing and print view no need for them&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;3-&lt;/strong&gt; Add the following members to the view class&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;public: &lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;BOOL m_b_IsIntersected; // weather there is intersection or not&lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: rgb(255, 102, 102);"&gt;&lt;span style="font-size:85%;"&gt;CRect m_Gray_Rectangle , m_Moving_Rectangle ,m_RectIntersection ;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// constant REct and moving and the rectangle of intersection&lt;/div&gt;&lt;br /&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;make your data members  public to avoid using getters and setters  &lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;4-&lt;/strong&gt;Initilize the values of the two rectangles in the constructor as follows &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:courier new;font-size:78%;"  &gt;CIntersectrectangleView::CIntersectrectangleView():m_Moving_Rectangle(100,60,160,120),m_Gray_Rectangle(90,80,120,110),m_b_IsIntersected(FALSE)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;5-&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Add the following messege handler to the derived view class&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;WM_TIMER ,WM_LBUTONDOWN, WM_RBUTTONDOWN&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and edit them as follows &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;start with Wm timer &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="color: rgb(255, 0, 0);font-size:78%;" &gt;&lt;strong&gt;void CIntersectrectangleView::OnTimer(UINT nIDEvent) {&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="color: rgb(255, 0, 0);font-size:78%;" &gt;&lt;strong&gt;if(m_Moving_Rectangle.right&gt; 300) m_Moving_Rectangle.OffsetRect(-280,0) ;&lt;br /&gt;&lt;br /&gt;m_Moving_Rectangle.OffsetRect(20,0);InvalidateRect(NULL,TRUE); CView::OnTimer(nIDEvent);}&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;and &lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;void CIntersectrectangleView::OnRButtonDown(UINT nFlags, CPoint point) { KillTimer(1);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CView::OnRButtonDown(nFlags, point);}&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="color: rgb(51, 0, 51);font-size:78%;" &gt;and &lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;void CIntersectrectangleView::OnLButtonDown(UINT nFlags, CPoint point) {&lt;br /&gt;&lt;br /&gt;SetTimer(1, 450,NULL) ;&lt;br /&gt;&lt;br /&gt;CView::OnLButtonDown(nFlags, point);&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:verdana;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 102, 102);font-family:Courier New;" &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 102, 102);font-family:Courier New;" &gt;6-&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color: rgb(255, 102, 102);font-family:Courier New;" &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color: rgb(0, 0, 0);font-family:Courier New;" &gt;edit the ondraw member functions as follows&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="color: rgb(0, 0, 0);font-family:Courier New;" &gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;void CIntersectrectangleView::OnDraw(CDC* pDC){&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="color: rgb(255, 102, 102);font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;pDC-&gt;TextOut(60,13,"Press the right button to start moving the black rectangle and the right to stop it and notice the intersection");&lt;br /&gt;&lt;br /&gt;pDC-&gt;SelectStockObject(BLACK_BRUSH); &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;pDC-&gt;Rectangle(m_Moving_Rectangle); &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;pDC-&gt;SelectStockObject(LTGRAY_BRUSH); &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;pDC-&gt;Rectangle(m_Gray_Rectangle);&lt;br /&gt;&lt;br /&gt;LPRECT lp_move = m_Moving_Rectangle.operator LPRECT() ; &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;// &lt;span style="color: rgb(51, 51, 255);"&gt;cast the moving &lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;rect to LPRECT&lt;/span&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;LPRECT lp_gray = m_Gray_Rectangle.operator LPRECT() ;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;br /&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="color: rgb(255, 102, 102);font-size:78%;" &gt;&lt;strong&gt;&lt;span style="color: rgb(102, 102, 204);"&gt;// and so as to the grayrect&lt;/span&gt; &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;m_b_IsIntersected = m_RectIntersection.IntersectRect( lp_move ,lp_gray);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;// find whethere there is intersection and draw the intersection rect with hatchbrush&lt;/span&gt;&lt;br /&gt;if( m_b_IsIntersected){ &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;CBrush brushHatch(HS_DIAGCROSS, RGB(255, 90, 0)); &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;pDC-&gt;SelectObject(brushHatch) ; &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=";font-family:courier new;font-size:78%;"  &gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;strong&gt;pDC-&gt;Rectangle(m_RectIntersection);&lt;br /&gt;//I used getstockobject because it is easier to use  &lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/div&gt;&lt;div&gt;&lt;strong&gt;&lt;a href="http://4.bp.blogspot.com/_VbplSiPqRyo/ScFcHgB24zI/AAAAAAAAADc/yK9m0Ow8DH8/s1600-h/intersect1.GIF"&gt;&lt;img id="BLOGGER_PHOTO_ID_5314630319200461618" style="margin: 0px 10px 10px 0px; float: left; width: 320px; height: 133px;" alt="" src="http://4.bp.blogspot.com/_VbplSiPqRyo/ScFcHgB24zI/AAAAAAAAADc/yK9m0Ow8DH8/s320/intersect1.GIF" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;}&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;8- finally build the application and see how it works&lt;/div&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VbplSiPqRyo/ScFcHgB24zI/AAAAAAAAADc/yK9m0Ow8DH8/s1600-h/intersect1.GIF"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do not forget to use casting when using intersictRect it only accept arguments of type LPRECT&lt;br /&gt;&lt;br /&gt;for more  example see the rest of the blog&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I hope that you enjoyed this tutorial&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:courier new;" &gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-4045722577236859778?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/4045722577236859778/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/03/visual-c-intersectrect-example-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/4045722577236859778'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/4045722577236859778'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/03/visual-c-intersectrect-example-tutorial.html' title='Visual c++  IntersectRect example tutorial'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VbplSiPqRyo/ScFhMxvh17I/AAAAAAAAADk/Vd2nGhLU_pc/s72-c/intersectionrect2.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-5143367713369676581</id><published>2009-02-03T10:48:00.000-08:00</published><updated>2009-02-03T11:38:15.479-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='result'/><category scheme='http://www.blogger.com/atom/ns#' term='CFormView'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='visual'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='devide'/><title type='text'>CFormView Example</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/SYiV2GVaoyI/AAAAAAAAACw/IQuDhh1DZH4/s1600-h/cformpic2.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 195px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SYiV2GVaoyI/AAAAAAAAACw/IQuDhh1DZH4/s320/cformpic2.JPG" alt="" id="BLOGGER_PHOTO_ID_5298649718247301922" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In this Visual c++ CformView Example  we used a  class derived  instead of CDialog&lt;br /&gt;This applications contains  2 buttons  one for devision and one for multiplication   and it has 2 Edit controls to hold the 2 number   involved in the arithmetic operation&lt;br /&gt;&lt;br /&gt;After pressing the devision  button here what you get&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_VbplSiPqRyo/SYiVT2a_6RI/AAAAAAAAACo/jafTNln92DM/s1600-h/cformphoto1.JPG"&gt;&lt;img style="cursor: pointer; width: 320px; height: 240px;" src="http://1.bp.blogspot.com/_VbplSiPqRyo/SYiVT2a_6RI/AAAAAAAAACo/jafTNln92DM/s320/cformphoto1.JPG" alt="" id="BLOGGER_PHOTO_ID_5298649129860196626" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;To create the application&lt;br /&gt;1-Start a new MFC application wizard       chose a name for  the project let us CFORMVIEWEX or any thing  u like  &lt;br /&gt;2-In the last step chose   CFormView as the parent of your derived view class&lt;br /&gt;&lt;br /&gt;3-Start building the dialog   as shown  above  chose  IDC_EDIT1 ,IDC_EDIT2 For the numbers on the lefts ,IDC_RESULT FOr the result number  IDC_MULTIPLY FOR multiplication button finally chose  IDC_DEVIDE for the devision&lt;br /&gt;&lt;br /&gt;4-In class wizard the following member variables m_number1  for the first edit control NUM1 ;&lt;br /&gt;   m_number2 for the second edit control second number  and finally for the result    m_results do not forget to chose CString type for all of the variables&lt;br /&gt;5- Add messege handler for the 2 buttons    and name them Mulitiplication and Devide Respectively  and edit the code of those functions&lt;br /&gt;&lt;br /&gt;Here what you get  the code is marked in Red&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;void CCFormViewExView::Mulitiplication() &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    double   first_number , second_number , result;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;UpdateData();//  Read data &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;first_number = atof( m_number1) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;second_number = atof( m_number2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;result = first_number * second_number ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;m_results.Format("%.3f", result) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;UpdateData(FALSE); // WriteData&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and the second function&lt;br /&gt;&lt;br /&gt;as follows&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;void CCFormViewExView::Devide() &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    double  NumA ,NumB , results ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    UpdateData();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    NumA = atoi( m_number1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    NumB = atoi(m_number2);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;    results =  NumA/NumB ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;  m_results.Format("%.5f", results) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;  UpdateData(FALSE);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102); font-weight: bold;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;6- Finaly build the application  stard putting numbers on the    edit control and see the results&lt;br /&gt;note the effect of using different parameters in Format function where  Devision has 5 decimal numbers than Multiplication which has only 3&lt;br /&gt;&lt;br /&gt;To download the whole project  click here  &lt;a href="http://www.4shared.com/file/83941562/675b1771/CFormViewEx.html"&gt;fullproject   &lt;/a&gt;and if you want the exe file   click here &lt;a href="http://www.4shared.com/file/83941559/dba49d3a/CFormViewEx.html"&gt;Exefile&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This  post contains many typos like devide  and others i made them for search engines intentionaly  Loll&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-5143367713369676581?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/5143367713369676581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/02/cformview-example.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5143367713369676581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/5143367713369676581'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/02/cformview-example.html' title='CFormView Example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_VbplSiPqRyo/SYiV2GVaoyI/AAAAAAAAACw/IQuDhh1DZH4/s72-c/cformpic2.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-7683368100842585414</id><published>2009-01-28T12:44:00.000-08:00</published><updated>2010-01-03T12:34:01.833-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='visual   c++'/><category scheme='http://www.blogger.com/atom/ns#' term='timer'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Microsoft Visual c++ Timer  Example</title><content type='html'>&lt;span style="color: rgb(51, 51, 51);"&gt;In This Tutorial &lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_VbplSiPqRyo/SYDEXjPZ6mI/AAAAAAAAACU/jQSZouLEZY8/s1600-h/timer1.JPG"&gt;&lt;span style="color: rgb(51, 51, 51);"&gt;microsoft visual c++ Timer example we use left mouse buttons to trigger the motion of a rectangle and kill the motion of a rectangle m_rect_time when left button up&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);"&gt; &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5296449070663592546" style="margin: 0px auto 10px; display: block; width: 320px; height: 136px; text-align: center;" alt="" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SYDEXjPZ6mI/AAAAAAAAACU/jQSZouLEZY8/s320/timer1.JPG" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;=&lt;br /&gt;&lt;br /&gt;note the photos here are protected by copyright  rules&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.4shared.com/file/88827958/c6c979eb/TimerEX.html"&gt;&lt;span style=";font-family:trebuchet ms;font-size:180%;"  &gt;&lt;strong&gt;DOWNLOADS&lt;/strong&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The downloadds contain the whole project plus the Exe in the debug  folder&lt;br /&gt;To start rect motion presss left mouse button and stop it press right mouse button click&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and start again using the left mouse the time was chosen is 300 milli seconds&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To start the tutorial&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1- Start new single document application and let us name it TimeEX and deselect printing and print proview&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2- In your derived view class add the following public data member m_rect_time ;&lt;br /&gt;&lt;br /&gt;3- In your view class initilise it as follows :m_rect_time( 20,20,50,50) .&lt;br /&gt;&lt;br /&gt;4- Add windows messege handlers for WM_TIMER , WM_RBUTTONDOWN, WM_LBUTTOMDOWN .&lt;br /&gt;&lt;br /&gt;5- Edit the OnTimer function as shown in red&lt;br /&gt;// timer action&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;void CTimerEXView::OnTimer(UINT nIDEvent) {&lt;br /&gt;&lt;br /&gt;if(m_rect_time.right&gt; 250 ) m_rect_time.OffsetRect( -250,0) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//   rectangle motion&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;m_rect_time.OffsetRect( 50,0) ; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;InvalidateRect(NULL,TRUE);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CView::OnTimer(nIDEvent);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6-Edit on left button handler as shown here in red&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;SetTimer(1, 300,NULL) ; // 3 00 millisecond&lt;br /&gt;&lt;br /&gt;// trigger the timer by setting the time &lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;3 00 millisecond 1 mearns first timer NULL timers window&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;7- Edit the on right buttom down as folows &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;KillTimer(1);&lt;br /&gt;&lt;br /&gt;// we have only one timer&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;8-Edit the ondRaw as follows&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;pDC-&gt;TextOut(70 ,70,"Press the left mouse button to start moving the rectangle using timer and right button to stop it") ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;pDC-&gt;SelectStockObject(BLACK_BR&lt;/span&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;USH );&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;pDC-&gt;Rectangle(m_rect_time) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 102, 102);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;9- Build the application and start stoping the rectangle as what I did here is the figure below&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_VbplSiPqRyo/SYDIfdY7sTI/AAAAAAAAACc/bKXRY02ZSEU/s1600-h/Timer2.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5296453604578406706" style="width: 320px; height: 107px;" alt="" src="http://3.bp.blogspot.com/_VbplSiPqRyo/SYDIfdY7sTI/AAAAAAAAACc/bKXRY02ZSEU/s320/Timer2.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;of course you can use bigger font for the text and can change tiime interval by change the value in settimer second paprameter&lt;br /&gt;&lt;br /&gt;Press  CTrl   F5  abd build it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to download the whole project click &lt;a href="http://www.4shared.com/file/88827958/c6c979eb/TimerEX.html"&gt;&lt;span style="font-size:180%;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:180%;"&gt;&lt;br /&gt;&lt;/span&gt;I hope that I guided how to create simple timer tutorial&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:georgia;font-size:180%;"  &gt;&lt;strong&gt;Hints&lt;/strong&gt;&lt;/span&gt;  To practice&lt;br /&gt;if you want multiple timers then is what you have to do is to trigger multiple timer by the function settimer by changing the first and second parameter&lt;br /&gt;for example if you have second timer SetTimer( 2,400, NULL)&lt;br /&gt;second one is set to 400 and add handler to killtimer by killTimer(2) ;&lt;br /&gt;and so on  also  try  different values in the     second parameters in settimer  (   ) and see the effects&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Use  callBack functions instead of the WM_TIMER you used  and try to control the clock by increasing  and decreasing time intervals using menus&lt;br /&gt;for lessons ans extra tutorials see the rest of the blog&lt;br /&gt;&lt;br /&gt;for notes and and comments leave me a post below&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;font-family:georgia;" &gt;Creating Dual Timers &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1  Create       buttons in the toolbar  as shown in  the figure   below&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_VbplSiPqRyo/S0D3bFhA0lI/AAAAAAAAAaw/vbceuGRabrI/s1600-h/Visual_c_toolbars_menu.GIF"&gt;&lt;img style="cursor: pointer; width: 231px; height: 35px;" src="http://3.bp.blogspot.com/_VbplSiPqRyo/S0D3bFhA0lI/AAAAAAAAAaw/vbceuGRabrI/s320/Visual_c_toolbars_menu.GIF" alt="" id="BLOGGER_PHOTO_ID_5422605996063248978" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Make    like them &lt;br /&gt;Then assign the following  ids  for the buttons&lt;br /&gt;&lt;br /&gt;IDC_GO_LEFT , IDC_BAN_HORIZONTAL_MOVES ,IDC_ACTIVATE_VERTICAL_MOVES  AND IDC_FREESE_UPDOWN&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;2- In the view   class add the following member variables &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;BOOL &lt;span style="font-weight: bold;"&gt;m_b_halt_leftright&lt;/span&gt;,m&lt;span style="font-weight: bold;"&gt;_Bol_suspended_UpDown_motion&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    CRect  m_animated_sqaure ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Make them public&lt;br /&gt;The    Boolean variables  are used  to enable moving  and the square is   the animated object&lt;br /&gt;&lt;br /&gt;3-Go to the constructor of the  class and  edit it as follows&lt;br /&gt;&lt;span style="font-family:verdana;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;CDualtimersView::CDualtimersView():m_animated_sqaure(20,20,50,50)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;m_b_halt_leftright = TRUE ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;m_Bol_suspended_UpDown_motion = TRUE ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// so at first   the square is stopped&lt;br /&gt;&lt;br /&gt; Now  go on Draw   virtual function and edit as follows&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnDraw(CDC* pDC)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pDC-&gt;TextOut(40,10," Press Toolbars bottons");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    pDC-&gt;SelectStockObject(BLACK_BRUSH  );&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pDC-&gt;Rectangle(m_animated_sqaure) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;//  The ondraw vertual function with dimentions  30 pixels by 30 pixels   draw black square&lt;br /&gt;&lt;br /&gt;Add windows message handler for the WM_timer and edit as&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnTimer(UINT IDEvent) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    switch(IDEvent) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    case 1:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;// first timer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    if(m_animated_sqaure.right&gt; 250 )&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;     m_animated_sqaure.OffsetRect( -250,0) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      m_animated_sqaure.OffsetRect( 20,0) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      InvalidateRect(NULL,TRUE);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; break ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    case 2:&lt;/span&gt;&lt;br /&gt;//&lt;span style="font-weight: bold;"&gt; second timer&lt;/span&gt;   and the action to  shift &lt;br /&gt;&lt;span style="font-style: italic;"&gt;        if(m_animated_sqaure.top &lt;10)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  m_animated_sqaure.OffsetRect(0,200);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; m_animated_sqaure.OffsetRect( 0,-10) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;      InvalidateRect(NULL,TRUE);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  break;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    default:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;        CView::OnTimer(IDEvent);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now   add  windows mesege handler  for the    Tolbar buttons&lt;br /&gt;&lt;br /&gt;We start with the first button&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnGoLeft() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;// see if the button not pressed&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    if(m_b_halt_leftright) {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    SetTimer( 1,500,NULL) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    // half a second &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  m_b_halt_leftright =FALSE ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and add Update windows messge handler for the same button&lt;br /&gt;void CDualtimersView::OnUpdateGoLeft(CCmdUI* pCmdUI)&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    pCmdUI-&gt;Enable(m_b_halt_leftright);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Do the same for the whole buttons  as you can see here&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnBanHorizontalMoves() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    if(!m_b_halt_leftright) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    KillTimer(1);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  m_b_halt_leftright =TRUE ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnUpdateBanHorizontalMoves(CCmdUI* pCmdUI) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pCmdUI-&gt;Enable(!m_b_halt_leftright);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnActivateVerticalStep() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    if(m_Bol_suspended_UpDown_motion) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    SetTimer( 2,200,NULL) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  m_Bol_suspended_UpDown_motion =FALSE ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnUpdateActivateVerticalStep(CCmdUI* pCmdUI) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pCmdUI-&gt;Enable(m_Bol_suspended_UpDown_motion);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnFreezeUpdown() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;if(!m_Bol_suspended_UpDown_motion) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    KillTimer(2);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;  m_Bol_suspended_UpDown_motion =TRUE ;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;void CDualtimersView::OnUpdateFreezeUpdown(CCmdUI* pCmdUI) &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;pCmdUI-&gt;Enable(!m_Bol_suspended_UpDown_motion);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As  an activity Add discription to the code i  did&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Note&lt;/span&gt;  use better method for naming&lt;br /&gt;and also  see the  toolbar  example  for more  on toolbars  and  use menu items  to     start and stop   the motion and  add keyboard accelerators&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Click  here  to download both examples   &lt;a href="http://www.4shared.com/file/88827958/c6c979eb/TimerEX.html"&gt;&lt;span style="font-size:180%;"&gt;&lt;span style="font-weight: bold;"&gt;Download link&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Please leave your feedback   below&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-7683368100842585414?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/7683368100842585414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/microsoft-visual-c-timer-example.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7683368100842585414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/7683368100842585414'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/microsoft-visual-c-timer-example.html' title='Microsoft Visual c++ Timer  Example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_VbplSiPqRyo/SYDEXjPZ6mI/AAAAAAAAACU/jQSZouLEZY8/s72-c/timer1.JPG' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6612093206108686431</id><published>2009-01-26T11:12:00.000-08:00</published><updated>2009-03-01T12:39:25.827-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='visual  s'/><category scheme='http://www.blogger.com/atom/ns#' term='c++  toolbar'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><title type='text'>Microsoft visual c++ toolbar example</title><content type='html'>&lt;div id="b13a" style="padding: 1em 0pt; text-align: left;"&gt;   Microsoft visual c++ toolbar example use  toolbar buttons  to move  movable rectangle  m_rect_movable in four directions  up, down , left and right   and  when intersected with a fixed rectangle  m_rect_fixed  it draws new rectangle with red - hatched pattern  and also it the movable rectangle  become blue hatched when it approaches the border rectangle  m_rectBorder .&lt;br /&gt;&lt;/div&gt;This prog&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_VbplSiPqRyo/SX4NBk4N91I/AAAAAAAAACE/G1Z9N5jGiWE/s1600-h/1TOOL.bmp"&gt;&lt;img style="cursor: pointer; width: 242px; height: 288px;" src="http://4.bp.blogspot.com/_VbplSiPqRyo/SX4NBk4N91I/AAAAAAAAACE/G1Z9N5jGiWE/s320/1TOOL.bmp" alt="" id="BLOGGER_PHOTO_ID_5295684532564784978" border="0" /&gt;&lt;/a&gt;ram is similar to a  previous program that used menu items to control the position of a movable rectangle&lt;br /&gt;There is 2  things to check the first one  is to check  the intersection between the movable rectangle and the fixed rectangle   so that draw a hatched pattern in the intersection rectangle  I could not use    IntersectRect  function  because it takes  LPCRECT  as parameters  and the other thing to check  was   if the movable rectangle  is  close  to the border rectangle  ,you can GetClientRect function to get the window's client area  instead of the border rectangle&lt;br /&gt;&lt;br /&gt;To build the application&lt;br /&gt;&lt;br /&gt;1-  Chose new and build single doc application and name it like TOOLBAR_MOVE_EX&lt;br /&gt;2-  In the resource view    go to toolbar and delete some of  the default buttoms and add  4 buttoms as shown in the fig below &lt;img style="width: 105px; height: 29px;" src="http://docs.google.com/File?id=df2q7nnp_19f3wxjqd4_b" /&gt;  and assign the following  IDs to them    &lt;span&gt;ID_SHIFT_LEFT ,&lt;/span&gt;&lt;span&gt;ID_SHIFT_RIGHT ,&lt;/span&gt;&lt;span&gt;ID_MOVE_UP and &lt;/span&gt;&lt;span&gt;ID_MOVE_DOWN  sorry  for the unpretty buttoms !!&lt;br /&gt;&lt;br /&gt;3-Add the  following data members to your derived CView class  ( 3 rectangles and 5 boolean variables)&lt;br /&gt;&lt;/span&gt;&lt;span&gt;CRect m_rectBorder , m_rect_movable, m_rect_fixed  ;  // border ,movable and fixed rectangles respectively&lt;br /&gt;&lt;/span&gt;&lt;span&gt;BOOL m_bLeftBorder ,m_bRightBorder,m_bTopBorder ,m_bButtomBorder ,m_bIntersect;&lt;br /&gt;//  border and intersection indicators&lt;br /&gt;4- In the view class initilize your data members as follows&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial;" &gt;CTOOLBAR_MOVE_EXView::CTOOLBAR_MOVE_EXView():m_rectBorder(10 ,10,340,340),m_rect_fixed(100,100,200,200) ,m_rect_movable(40,30,90,130)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;m_bLeftBorder =m_bRightBorder =m_bTopBorder =m_bButtomBorder =m_bIntersect==FALSE ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5- In your view add  windows messege handlers for command and update command as follows&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial;" &gt;void CTOOLBAR_MOVE_EXView::OnShiftLeft()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;if(m_rect_movable.left &lt;=(m_rectBorder.left +40))      m_bLeftBorder = TRUE ;             m_rect_movable.OffsetRect(-10,0);      m_bRightBorder  = FALSE ;      if (m_rect_fixed.PtInRect(m_rect_movable.TopLeft())  | m_rect_fixed.PtInRect(m_rect_movable.BottomRight())| m_rect_fixed.PtInRect(CPoint(m_rect_movable.right,m_rect_movable.top))|m_rect_fixed.PtInRect(CPoint( m_rect_movable.left,m_rect_movable.bottom))) {          m_bIntersect =TRUE ;       }            InvalidateRect(NULL,TRUE);              }  void CTOOLBAR_MOVE_EXView::OnUpdateShiftLeft(CCmdUI* pCmdUI) {       pCmdUI-&gt;Enable(!m_bLeftBorder);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CTOOLBAR_MOVE_EXView::OnShiftRight()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; if(m_rect_movable.right    &gt;= ( m_rectBorder.right -30 ))&lt;br /&gt; m_bRightBorder = TRUE ;&lt;br /&gt;&lt;br /&gt;  m_rect_movable.OffsetRect(10,0);&lt;br /&gt;   m_bLeftBorder = FALSE ;&lt;br /&gt;&lt;br /&gt;  if (m_rect_fixed.PtInRect(m_rect_movable.TopLeft())  | m_rect_fixed.PtInRect(m_rect_movable.BottomRight())| m_rect_fixed.PtInRect(CPoint(m_rect_movable.right,m_rect_movable.top))|m_rect_fixed.PtInRect(CPoint( m_rect_movable.left,m_rect_movable.bottom))) {&lt;br /&gt;      m_bIntersect =TRUE ;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  InvalidateRect(NULL,TRUE);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CTOOLBAR_MOVE_EXView::OnUpdateShiftRight(CCmdUI* pCmdUI)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; pCmdUI-&gt;Enable(!m_bRightBorder);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CTOOLBAR_MOVE_EXView::OnMoveDown()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;if( m_rect_movable.bottom &gt;= ( m_rectBorder.bottom -20))&lt;br /&gt;    m_bButtomBorder = TRUE ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  m_rect_movable.OffsetRect(0,10) ;&lt;br /&gt;   m_bTopBorder =  FALSE ;&lt;br /&gt;&lt;br /&gt;if (m_rect_fixed.PtInRect(m_rect_movable.TopLeft())  | m_rect_fixed.PtInRect(m_rect_movable.BottomRight())| m_rect_fixed.PtInRect(CPoint(m_rect_movable.right,m_rect_movable.top))|m_rect_fixed.PtInRect(CPoint( m_rect_movable.left,m_rect_movable.bottom))) {&lt;br /&gt;      m_bIntersect =TRUE ;&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  InvalidateRect(NULL,TRUE);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CTOOLBAR_MOVE_EXView::OnUpdateMoveDown(CCmdUI* pCmdUI)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;pCmdUI-&gt;Enable(!m_bButtomBorder);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void CTOOLBAR_MOVE_EXView::OnMoveUp()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;if(m_rect_movable.top &lt;= (m_rectBorder.top +  20))     m_bTopBorder =TRUE ;           m_rect_movable.OffsetRect(0,-10) ;       m_bButtomBorder =  FALSE ;          if (m_rect_fixed.PtInRect(m_rect_movable.TopLeft())  | m_rect_fixed.PtInRect(m_rect_movable.BottomRight())| m_rect_fixed.PtInRect(CPoint(m_rect_movable.right,m_rect_movable.top))|m_rect_fixed.PtInRect(CPoint( m_rect_movable.left,m_rect_movable.bottom))) {          m_bIntersect =TRUE ;       }            InvalidateRect(NULL,TRUE);       }  void CTOOLBAR_MOVE_EXView::OnUpdateMoveUp(CCmdUI* pCmdUI) {        pCmdUI-&gt;Enable(!m_bTopBorder);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;6- Edit the  OnDraw  member function of your generated view&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;pDC-&gt;Rectangle(m_rectBorder) ; // white hallow &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;pDC-&gt;SelectStockObject(LTGRAY_BRUSH);  // outer rectangle &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;pDC-&gt;Rectangle(m_rect_fixed);  // fixed rectangle &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt; CBrush bluebrush(HS_DIAGCROSS, RGB(0, 0, 250)); // blue brush for border condition when moveable rect on border&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;pDC-&gt;SelectStockObject(BLACK_BRUSH);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;if(m_bLeftBorder |m_bRightBorder |m_bTopBorder |m_bButtomBorder)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt; pDC-&gt;SelectObject(bluebrush) ; // if  in nearby the  border rectangle &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;pDC-&gt;Rectangle(m_rect_movable);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;if(m_bIntersect) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;    CRect rc_intersection ;// use red hatch pattern   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;     rc_intersection.IntersectRect(m_rect_movable ,m_rect_fixed);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;     CBrush brushHatch(HS_DIAGCROSS, RGB(255, 90, 0));&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;     pDC-&gt;SelectObject(brushHatch) ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;     pDC-&gt;Rectangle(rc_intersection);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);font-family:Arial Narrow;" &gt;}&lt;/span&gt;&lt;br /&gt;7- try to move  the movable rectangle  around  when you start  the application you will start with a window like  this  &lt;div id="c40:" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 302px; height: 323px;" src="http://docs.google.com/File?id=df2q7nnp_21fv4txmgq_b" /&gt; and after moving it for some bushes on the button you will get similar to  this   and try to move near the corners to see  what happens there&lt;br /&gt;&lt;div id="e6b0" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 348px; height: 298px;" src="http://docs.google.com/File?id=df2q7nnp_22cxmm79c6_b" /&gt;&lt;br /&gt;&lt;br /&gt; to dowbload the whole project    clich the link &lt;a href="http://www.4shared.com/file/88828758/943444b7/toolbar_move_ex.html"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and the exe &lt;a href="http://www.4shared.com/file/88828769/c81e27e2/TOOLBAR_MOVE_EX.html"&gt;file &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and do not forget to add accelerator use GetClientRect instead of the border Rect&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6612093206108686431?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6612093206108686431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/microsoft-visual-c-toolbar-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6612093206108686431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6612093206108686431'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/microsoft-visual-c-toolbar-example.html' title='Microsoft visual c++ toolbar example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_VbplSiPqRyo/SX4NBk4N91I/AAAAAAAAACE/G1Z9N5jGiWE/s72-c/1TOOL.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-2172862364355232269</id><published>2009-01-25T12:43:00.000-08:00</published><updated>2009-01-26T02:17:46.288-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++  conditional return example'/><title type='text'>c++  conditional return example</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;In this c++ condition return example      we made a function the accept both positive and negative numbers and produce the output of the square rout&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;if the number is negative the output would the square rout of absolute value otherwise the output will the square rout &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;at first the the program check the number if it is positive or negative&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;This is simple c++ conditional return example that uses  if statement to check the value of the number entered &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;as seen in the red code below&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#include &lt;iostream&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;#include &lt;cmath&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;using namespace std ; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;double sqr( double x) {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;if( x&lt;0)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;return sqrt(-x) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;return sqrt(x) ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;int main() {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;cout&lt;&lt; "Enter the number you to get square rout positive or negative "&lt;&lt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;double x , result ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;cin&gt;&gt; x;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;result = sqr (x);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;cout&lt;&lt;"The resuly is square rout of the number you entered " &lt;&lt;&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;return 0 ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-2172862364355232269?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/2172862364355232269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-conditional-return-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2172862364355232269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/2172862364355232269'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-conditional-return-example.html' title='c++  conditional return example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-4450426075548470369</id><published>2009-01-23T11:57:00.000-08:00</published><updated>2010-04-29T12:50:35.969-07:00</updated><title type='text'>Visual c++ Menu Example</title><content type='html'>&lt;b&gt;&lt;a href="http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html"&gt;download&lt;/a&gt;&lt;/b&gt;&lt;a href="http://2.bp.blogspot.com/_VbplSiPqRyo/SXotqJiVCoI/AAAAAAAAAB0/bbDoQyfngY8/s1600-h/1Menu.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5294594514065099394" src="http://2.bp.blogspot.com/_VbplSiPqRyo/SXotqJiVCoI/AAAAAAAAAB0/bbDoQyfngY8/s320/1Menu.bmp" style="cursor: pointer; float: left; height: 129px; margin: 0pt 10px 10px 0pt; width: 253px;" /&gt;&lt;/a&gt;&lt;br /&gt;In this Visual c++ menu example  we Top level  Move  with 4 pop_up  items   Up ,Down ,Left  and Right to move  a rectangle rcRect inside the borders of  a bigger rectangle rcBorder .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;&lt;b style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;a href="http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html"&gt;working example&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;To create the program&lt;br /&gt;1- Start new   Single document MFC exe application and deselect printing and print view options&lt;br /&gt;2-In the resource View to   IDR_MAINFRAME menu and make   add  the following items as shown in Fig 1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="font-family: Verdana,sans-serif;"&gt;&lt;span style="background-color: #20124d; font-size: x-large;"&gt;Downloads&lt;a href="http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html"&gt;http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;3- In your derived view cl&lt;span id="goog_195434994"&gt;&lt;/span&gt;&lt;span id="goog_195434995"&gt;&lt;/span&gt;&lt;a href="http://draft.blogger.com/"&gt;&lt;/a&gt;as&lt;span style="background-color: #f3f3f3;"&gt;&lt;/span&gt;s add the following member functions  and make them public&lt;br /&gt;&lt;br /&gt;BOOL m_bLeft,m_bRight ,m_bDOWN   , m_bUp ; // these are the left right top bottom borders indicators&lt;br /&gt;&lt;br /&gt;CRect  rcRect ,rcBorder ; // small rectangle and the bigger rectangle rcBorder&lt;br /&gt;&lt;br /&gt;4-In your derived  view class   initilise the date  as  shown  &lt;br /&gt;&lt;span style="color: red;"&gt;CMove_RectView::CMove_RectView():rcRe&lt;/span&gt;&lt;span style="color: red;"&gt;ct(100,100,50,50),rcBorder( 20 ,20 ,300,300)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;{&lt;br /&gt;&lt;br /&gt;m_bLeft =m_bRight  =  m_bDOWN  =m_bUp =FALSE ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5-Add messege handlers to your menuitem  IDs&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;void CMove_RectView::OnMoveUp() &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt; &lt;span style="color: red;"&gt;    rcRect.OffsetRect(0 ,-20);&lt;/span&gt; &lt;span style="color: red;"&gt;         &lt;/span&gt; &lt;span style="color: red;"&gt;        m_bDOWN =FALSE ;&lt;/span&gt; &lt;span style="color: red;"&gt;        if((rcRect.top   -70) &amp;lt;= rcBorder.top)&lt;/span&gt; &lt;span style="color: red;"&gt;          m_bUp =TRUE ;&lt;/span&gt;    &lt;span style="color: red;"&gt;InvalidateRect(NULL ,TRUE );&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt;    &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnUpdateMoveUp(CCmdUI* pCmdUI) &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt; &lt;span style="color: red;"&gt;        pCmdUI-&amp;gt;Enable(!m_bUp);&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt;   &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnMoveDown() &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt;  &lt;span style="color: red;"&gt;        rcRect.OffsetRect(0, 20);&lt;/span&gt; &lt;span style="color: red;"&gt;       &lt;/span&gt;  &lt;span style="color: red;"&gt;        m_bUp =FALSE &lt;/span&gt;&lt;span style="color: red;"&gt;;&lt;/span&gt;  &lt;span style="color: red;"&gt;               if&lt;/span&gt;&lt;span style="color: red;"&gt;((rcRect.bottom)   &amp;gt;=  (rcBorder.bottom -70)  )&lt;/span&gt; &lt;span style="color: red;"&gt;       m_bDOWN =TRUE ;&lt;/span&gt;  &lt;span style="color: red;"&gt;       InvalidateRect(NULL ,TRUE );&lt;/span&gt;   &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnUpdateMoveDown(CCmdUI* pCmdUI) &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;    pCmdUI-&amp;gt;Enable(! m_bDOWN) ;&lt;/span&gt;  &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnMoveLeft() &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;if( (rcRect.left)  &amp;lt;=rcBorder.left +  70)&lt;/span&gt; &lt;span style="color: red;"&gt;m_bLeft = TRUE  ;&lt;/span&gt; &lt;span style="color: red;"&gt;     rcRect.OffsetRect(-10 , 0);&lt;/span&gt;  &lt;span style="color: red;"&gt;m_bRight = FALSE ;&lt;/span&gt;   &lt;span style="color: red;"&gt;InvalidateRect(NULL  ,TRUE );&lt;/span&gt;    &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnUpdateMoveLeft(CCmdUI&lt;/span&gt;&lt;span style="color: red;"&gt;* pCmdUI) &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt;  &lt;span style="color: red;"&gt;    pCmdUI-&amp;gt;Enable(!m_bLeft);&lt;/span&gt;  &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnMoveRight() &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt;   &lt;span style="color: red;"&gt;        rcRect.OffsetRect(20 ,0);&lt;/span&gt; &lt;span style="color: red;"&gt;     m_bLeft = FALSE ;&lt;/span&gt; &lt;span style="color: red;"&gt;    InvalidateRect(NULL  ,TRUE );&lt;/span&gt; &lt;span style="color: red;"&gt;if((rcBorder.r&lt;/span&gt;&lt;span style="color: red;"&gt;ight)&amp;lt;= rcRect.right)&lt;/span&gt; &lt;span style="color: red;"&gt;m_bRight=TRUE ;&lt;/span&gt;   &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;}&lt;/span&gt;  &lt;span style="color: red;"&gt;void CMove_RectView::OnUpdateMoveRight(CCmdUI* pCmdUI) &lt;/span&gt; &lt;span style="color: red;"&gt;{&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;    pCmdUI-&amp;gt;Enable(!m_bRight);&lt;/span&gt; &lt;span style="color: red;"&gt;    &lt;/span&gt; &lt;span style="color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6- Finally edit the  OnDraw function in your view class as follows&lt;br /&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;void CMove_RectView::OnDraw(CDC* pDC)&lt;br /&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red;"&gt; &lt;br /&gt;pDC-&amp;gt;Rectangle(rcBorder) ;&lt;br /&gt;if( m_bLeft |m_bRight |m_bDOWN   |m_bUp)&lt;br /&gt;pDC-&amp;gt;SelectStockObject(DKGRAY_BRUSH ) ;&lt;br /&gt;// if the small rect  near the big rect&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;    pDC-&amp;gt;Rectangle(rcRect);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: black;"&gt;7- Build the application and see how it works&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;&lt;span style="color: black;"&gt;8- Try to move the small Rect with the menu options UP DOWN LEFT AND RIGHT   And when move near the borders of the big rectangle you get something like in the fig 2 &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VbplSiPqRyo/SXouMZbmqVI/AAAAAAAAAB8/0PAU268BQmA/s1600-h/2Menu.bmp" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5294595102447413586" src="http://4.bp.blogspot.com/_VbplSiPqRyo/SXouMZbmqVI/AAAAAAAAAB8/0PAU268BQmA/s320/2Menu.bmp" style="cursor: pointer; height: 320px; width: 269px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;to download the whole project clich &lt;a href="http://www.4shared.com/file/88832447/4d0b1fea/Menu_Move_Rect.html"&gt;here &lt;/a&gt;&lt;br /&gt;and the exe file   click  &lt;a href="http://www.4shared.com/file/88832437/24a892d/Move_Rect.html"&gt;here  &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;things to add  are keyboad accelerators    to do&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-4450426075548470369?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/4450426075548470369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/visual-c-menu-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/4450426075548470369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/4450426075548470369'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/visual-c-menu-example.html' title='Visual c++ Menu Example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_VbplSiPqRyo/SXotqJiVCoI/AAAAAAAAAB0/bbDoQyfngY8/s72-c/1Menu.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-6918874479471199972</id><published>2009-01-18T11:11:00.001-08:00</published><updated>2009-01-18T11:25:44.127-08:00</updated><title type='text'>C++ overloaded function example</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Georgia;"&gt;C++ overloaded function example in this tuturial we used the c++ property of overloading to use single function for different purposes  square rout , addition , multiplication and devision  in one single operation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Georgia;"&gt; we include cmath library in order to use math functions  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Georgia;"&gt;The code below marked in red demonstrate  how made this sample progra&lt;/span&gt;m&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;#include &lt;iostream&gt; &lt;/iostream&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;#include &lt;cmath&gt; &lt;/cmath&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;using namespace std ; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION( double  a){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return sqrt( a);}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double  SQUAREROOT_MULTIPLY_SUM_DEVISION( double a , double b){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return  a *b ;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION (double a ,double b, double c){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return  a + b + c ;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION( double a ,double b, double c , double d){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return a /( b +c +d) ; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;C++ overloaded function example  In this tutorial  we used the property of overloading  to use single function for 4 different purposes Square rout addition multiplication and division  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;int main (){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    cout &lt;&lt; " this program  used single function to perform  square rout , multiplication , addition and devisition  in single operation " &lt;&lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double   w =  SQUAREROOT_MULTIPLY_SUM_DEVISION(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt; cout&lt;&lt; " square root of 4   ="&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt; double x = SQUAREROOT_MULTIPLY_SUM_DEVISION( 12 ,14);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt; " the sum of   13 and 14 is "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double  y  = SQUAREROOT_MULTIPLY_SUM_DEVISION( 2 ,3,4);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt;"  2 *3*4 = "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double z  = SQUAREROOT_MULTIPLY_SUM_DEVISION ( 100, 2,3,5);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt; " 100 / ( 2 + 3 +5) "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;return 0 ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-6918874479471199972?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/6918874479471199972/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-overloaded-function-example_18.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6918874479471199972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/6918874479471199972'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-overloaded-function-example_18.html' title='C++ overloaded function example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-3378215587089379008</id><published>2009-01-18T11:11:00.000-08:00</published><updated>2009-01-18T11:13:19.141-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='overloaded'/><category scheme='http://www.blogger.com/atom/ns#' term='library'/><title type='text'>C++ overloaded function example</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: Georgia;"&gt;C++ overloaded function example in this tuturial we used the c++ property of overloading to use single function for different purposes  square rout , addition , multiplication and devision  in one single operation&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;span style="font-family: Georgia;"&gt; we include cmath library in order to use math functions  &lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;span style="font-family: Georgia;"&gt;The code below marked in red demonstrate  how made this sample progra&lt;/span&gt;m&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;#include &lt;iostream&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;#include &lt;cmath&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;using namespace std ; &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION( double  a){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return sqrt( a);}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double  SQUAREROOT_MULTIPLY_SUM_DEVISION( double a , double b){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return  a *b ;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION (double a ,double b, double c){&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return  a + b + c ;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double SQUAREROOT_MULTIPLY_SUM_DEVISION( double a ,double b, double c , double d){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    return a /( b +c +d) ; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;C++ overloaded function example  In this tutorial  we used the property of overloading  to use single function for 4 different purposes Square rout addition multiplication and division  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;int main (){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;    cout &lt;&lt; " this program  used single function to perform  square rout , multiplication , addition and devisition  in single operation " &lt;&lt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double   w =  SQUAREROOT_MULTIPLY_SUM_DEVISION(4);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt; cout&lt;&lt; " square root of 4   ="&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt; double x = SQUAREROOT_MULTIPLY_SUM_DEVISION( 12 ,14);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt; " the sum of   13 and 14 is "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double  y  = SQUAREROOT_MULTIPLY_SUM_DEVISION( 2 ,3,4);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt;"  2 *3*4 = "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;double z  = SQUAREROOT_MULTIPLY_SUM_DEVISION ( 100, 2,3,5);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;cout &lt;&lt; " 100 / ( 2 + 3 +5) "&lt;&lt;&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;return 0 ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-3378215587089379008?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/3378215587089379008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-overloaded-function-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3378215587089379008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/3378215587089379008'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/c-overloaded-function-example.html' title='C++ overloaded function example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-1225754738063306331</id><published>2009-01-17T12:24:00.000-08:00</published><updated>2009-03-01T12:29:44.141-08:00</updated><title type='text'>MFC visual c++ CstringArray Example</title><content type='html'>In this  MFC visual  c++   CstringArray example we used   CstringArray class in order to display time  on status bar bans we used it to display seconds , minutes and  hours&lt;br /&gt;&lt;br /&gt;1 - Build  MFC application  single document  and chose not to select  printing and printing preview&lt;br /&gt;2 - Add resource element in the View menu  chose  resource simbols and New  and name it ID_TIMEARRAY&lt;br /&gt;3-Add  handlers  in the CmainFrame for   &lt;i&gt;ID_VIEW_STATUS_BAR and  &lt;/i&gt;update handler for  it,&lt;br /&gt;4-&lt;i&gt;Re&lt;/i&gt;place the previously created  indicators array with 3 ID_SEPARATOR  to hold second minutes and  hours respectively    and make &lt;i&gt;m_wndStatusBar&lt;/i&gt;  data member public instead of private  .&lt;br /&gt;5- &lt;span style="font-family:verdana;"&gt;Replace   if (!m_wndStatusBar.Create(this)  with  this&lt;/span&gt;&lt;b  style="font-family:verdana;"&gt;, &lt;span style="color: rgb(76, 17, 48);"&gt;WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:verdana;"&gt;ID_TIMEARRAY&lt;/span&gt;&lt;span style="color: rgb(76, 17, 48);font-family:verdana;" &gt;) ;&lt;/span&gt;so as not to use the default status bar .&lt;br /&gt;6-&lt;br /&gt;&lt;pre  style="font-family:verdana;"&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void CMainFrame::OnViewStatusBar()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;m_wndStatusBar.ShowWindow((m_wndStatusBar.GetStyle() &amp;amp;&lt;br /&gt;WS_VISIBLE) == 0);&lt;br /&gt;RecalcLayout();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;pCmdUI-&gt;SetCheck((m_wndStatusBar.GetStyle() &amp;amp; WS_VISIBLE) != 0);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;} in  mainframe.cpp&lt;br /&gt;&lt;br /&gt;7- &lt;/span&gt;Add   the following  function OnDraw to your  View class       &lt;span style="color: rgb(120, 63, 4);font-family:Comic Sans MS;" &gt;  &lt;/span&gt;&lt;b&gt;&lt;span style="color: rgb(120, 63, 4);font-family:Comic Sans MS;" &gt;pDC-&gt;TextOut(30, 30 ,Press the left key to see your computer current time on the status bar ");&lt;br /&gt;and add  &lt;/span&gt;&lt;/b&gt;&lt;b&gt;#include "MainFrm.h" near the top of your view class &lt;/b&gt;&lt;/pre&gt;8-   ADd  the following code to  OnLbuttonDown handler in your   view class&lt;br /&gt;CTime  currenttime = GetCurrentTime();&lt;br /&gt;    int sec , min , hours ;&lt;br /&gt;    hours = currenttime.GetHour();&lt;br /&gt;    min = currenttime.GetMinute();&lt;br /&gt;    sec = currenttime.GetSecond();&lt;br /&gt;CMainFrame* pFrame = (CMainFrame*) AfxGetApp()-&gt;m_pMainWnd;&lt;br /&gt;   CStatusBar* pStatus = &amp;amp;pFrame-&gt;m_wndStatusBar;&lt;br /&gt;&lt;br /&gt;CStringArray timearray ;&lt;br /&gt;timearray.SetSize(3);&lt;br /&gt;CString strsec ,strmin ,strhours ;&lt;br /&gt;strsec.Format("%d ",sec);&lt;br /&gt;strmin.Format("%d " , min);&lt;br /&gt;strhours.Format("%d  " ,hours );&lt;br /&gt;timearray[0] =  strsec ;&lt;br /&gt;timearray[1] = strmin ;&lt;br /&gt;timearray[2]  = strhours ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   pStatus-&gt;SetPaneText(0, timearray[0]);&lt;br /&gt;   pStatus-&gt;SetPaneText(1 ,timearray[1] );&lt;br /&gt;   pStatus-&gt;SetPaneText(2 ,timearray[2]);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;to download the whole project clock &lt;a href="http://www.4shared.com/file/88827149/a6c62984/stringarray_time.html"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt; to download the Exe file  click here&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-1225754738063306331?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/1225754738063306331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/mfc-visual-c-cstringarray-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/1225754738063306331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/1225754738063306331'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/mfc-visual-c-cstringarray-example.html' title='MFC visual c++ CstringArray Example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1168125206956184142.post-8009948118712237644</id><published>2009-01-17T08:42:00.000-08:00</published><updated>2009-03-01T12:26:19.753-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='example'/><category scheme='http://www.blogger.com/atom/ns#' term='visual  s'/><category scheme='http://www.blogger.com/atom/ns#' term='tatusbar'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='MFC'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><title type='text'>visual c++ Status  bar example</title><content type='html'>1-  Make single  document MFC application and deselect  printing and printview options&lt;br /&gt;2-  In the view menu chose resource and then add  New resource  and then add ID_TIME_STATUSBAR   and accept the defaul value (101) .&lt;br /&gt;3- Add message handler and update message handler  in the CMainFrame class for both  &lt;i&gt;ID_VIEW_STATUS_BAR .&lt;br /&gt;4- Re&lt;/i&gt;place the previously created  indicators array with single  ID_SEPARATOR  and make sure that the CMainFrame   data  member &lt;i&gt;m_wndStatusBar&lt;/i&gt;  is public instead of protected so that it can be accessed from the View  class   .&lt;br /&gt;5- Replace   if (!m_wndStatusBar.Create(this)  with  this&lt;b&gt;, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, &lt;/b&gt;ID_TIME_STATUSBAR) ;&lt;br /&gt;&lt;br /&gt;6-  Add the following code to ur CMainFrame.cpp&lt;br /&gt;&lt;pre&gt;void CMainFrame::OnViewStatusBar()&lt;br /&gt;{&lt;br /&gt;&lt;b style="color: rgb(255, 0, 255);"&gt;m_wndStatusBar.ShowWindow((m_wndStatusBar.GetStyle() &amp;amp;&lt;br /&gt;WS_VISIBLE) == 0);&lt;br /&gt;RecalcLayout();&lt;/b&gt;&lt;br /&gt;}&lt;br /&gt;void CMainFrame::OnUpdateViewStatusBar(CCmdUI* pCmdUI)&lt;br /&gt;{&lt;br /&gt;&lt;b style="color: rgb(255, 0, 255);"&gt;pCmdUI-&gt;SetCheck((m_wndStatusBar.GetStyle() &amp;amp; WS_VISIBLE) != 0);&lt;/b&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; 7- Add   the following  function OnDraw to your  View class         &lt;b&gt;pDC-&gt;TextOut(30, 30 ,Press the left key to see your computer current time on the status bar ");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8-   &lt;/b&gt;Edit OnDraw messege handler as  follows &lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;&lt;span style="color: rgb(255, 0, 255);"&gt;CTime  currenttime = GetCurrentTime();&lt;br /&gt;  int sec , min , hours ;&lt;br /&gt;  hours = currenttime.GetHour();&lt;br /&gt;  min = currenttime.GetMinute();&lt;br /&gt;  sec = currenttime.GetSecond();&lt;br /&gt;CMainFrame* pFrame = (CMainFrame*) AfxGetApp()-&gt;m_pMainWnd;&lt;br /&gt; CStatusBar* pStatus = &amp;amp;pFrame-&gt;m_wndStatusBar;&lt;br /&gt; CString  strtime ;&lt;br /&gt; strtime.Format( "%d  %d  %d ", hours,min , sec );&lt;br /&gt; pStatus-&gt;SetPaneText(0, strtime );&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Finally  include    &lt;b&gt;#include "MainFrm.h" near the&lt;/b&gt; top with other include statements&lt;br /&gt;&lt;br /&gt;to  download the exe file  click &lt;a href="http://www.4shared.com/file/88826801/7b1c3858/timestatusbar.html"&gt;here &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;and the whole project  &lt;a href="http://www.4shared.com/file/88826787/51fa5058/timestatusbarex.html"&gt;here    &lt;/a&gt;&lt;br /&gt;this  contains sum errors&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1168125206956184142-8009948118712237644?l=visualcsamples.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualcsamples.blogspot.com/feeds/8009948118712237644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/visual-c-status-bar-example.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8009948118712237644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1168125206956184142/posts/default/8009948118712237644'/><link rel='alternate' type='text/html' href='http://visualcsamples.blogspot.com/2009/01/visual-c-status-bar-example.html' title='visual c++ Status  bar example'/><author><name>Mohammad  Hawash</name><uri>http://www.blogger.com/profile/02823883389678040874</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
