<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8108645605049629138</atom:id><lastBuildDate>Mon, 16 Apr 2012 02:50:42 +0000</lastBuildDate><title>Codes By Shariq Khan</title><description>Program Codes in C, C++, C#, Java, VB, C#, C++, ASP.Net, PHP, MySQL etc. Tips for Linux, Windows, MS- Office. Help topics of Computer Programing, Computer Fundamentals etc.</description><link>http://codesbyshariq.blogspot.com/</link><managingEditor>noreply@blogger.com (Shariq Khan)</managingEditor><generator>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/blogspot/codesbyshariq" /><feedburner:info uri="blogspot/codesbyshariq" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-2890222093644089083</guid><pubDate>Sat, 31 Oct 2009 13:19:00 +0000</pubDate><atom:updated>2009-10-31T06:19:30.985-07:00</atom:updated><title>Adding Server Control Dynamically in ASP.Net</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/24ccEsKThUfKRAIQBCc6d9_RJEs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/24ccEsKThUfKRAIQBCc6d9_RJEs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/24ccEsKThUfKRAIQBCc6d9_RJEs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/24ccEsKThUfKRAIQBCc6d9_RJEs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;New or Casual Coder feels difficult to  create asp.net  server controls dynamically. I am givin an example to add Panel Control(which servers as a containter for other server controls ) and a Label control into asp.net form dynamically. The following in the code portion which is to be written in the Page_Load.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        Panel p1 = new Panel();&lt;br /&gt;        this.form1.Controls.Add(p1);&lt;br /&gt;        Label l1= new Label();&lt;br /&gt;        l1.Text="Test Label in Panel";&lt;br /&gt;&lt;br /&gt;        p1.Width = 200;&lt;br /&gt;        p1.Height = 200;&lt;br /&gt;        p1.BackColor = System.Drawing.Color.Red;&lt;br /&gt;        p1.BorderColor = System.Drawing.Color.Black;&lt;br /&gt;        p1.Controls.Add(l1);&lt;br /&gt;        p1.Visible = true;&lt;br /&gt;        p1.Enabled = true;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;First line on code creates an instance of Panel by the name p1, second line adds this panel instance "p1" to the current asp.net form "form1", next line creates an instance of lable control in the name of "l1" and assign some text to it. Next line changes some properties like height, width and backgournd color etc. After that Newly created label "l1" is added to a panel "p1";&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-2890222093644089083?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/GH9-y8rRcn0/adding-server-control-dynamically-in.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>2</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2009/10/adding-server-control-dynamically-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-6142702196116442212</guid><pubDate>Tue, 04 Dec 2007 10:01:00 +0000</pubDate><atom:updated>2007-12-04T12:19:35.700-08:00</atom:updated><title>Evaluation of Mathematical Formulae using C- Langauge</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Iwl3JUjN7SPCLRLnO5Cfw_gpLEE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Iwl3JUjN7SPCLRLnO5Cfw_gpLEE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Iwl3JUjN7SPCLRLnO5Cfw_gpLEE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Iwl3JUjN7SPCLRLnO5Cfw_gpLEE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;1. Fiding area of tirangle using Hero's Formula (C-language). Hero's Formula is &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;Area=squarerootof(S(S-a)(S-b)(S-c) where a,b,c are the sides of triangle and S=(a+b+c)/2 is the semiperimeter of trinagle.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;float a,b,c,ans;&lt;br /&gt;float area(float,float,float); //Prototype or Function Declaration&lt;br /&gt;clrscr();&lt;br /&gt;&lt;br /&gt;printf("\n Enter the First Side of Triangle");&lt;br /&gt;scanf("%f",&amp;amp;a);&lt;br /&gt;printf("\n Enter the Second Side of Triangle");&lt;br /&gt;scanf("%f",&amp;amp;b);&lt;br /&gt;printf("\n Enter the Third Side of Triangle");&lt;br /&gt;scanf("%f",&amp;amp;c);&lt;br /&gt;&lt;br /&gt;ans=area(a,b,c);//Calling function for a,b,c;&lt;br /&gt;&lt;br /&gt;printf("\n Area of Give Triangle is =%.2f,ans);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Function Definition&lt;br /&gt;&lt;br /&gt;float area(float p, float q, float r)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;float s, mult, sq;&lt;br /&gt;s=(a+b+c)/2;&lt;br /&gt;mult=s*(s-a)*(s-b)*(s-c);&lt;br /&gt;sq=sqrt(mult); //sqrt() is defined in math.h and used to find square root of given number&lt;br /&gt;return(sq);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-6142702196116442212?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/G8jCCpeahkQ/mathematical-formulas-and-c-langauges.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/12/mathematical-formulas-and-c-langauges.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-2925783294255752149</guid><pubDate>Tue, 20 Nov 2007 14:13:00 +0000</pubDate><atom:updated>2007-11-20T06:16:11.736-08:00</atom:updated><title>Graphics Demo in C- Langauge</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4YU_SWy4ewShbt-meZSjdp-hqCo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4YU_SWy4ewShbt-meZSjdp-hqCo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4YU_SWy4ewShbt-meZSjdp-hqCo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4YU_SWy4ewShbt-meZSjdp-hqCo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;color:#006600;"&gt;Using Various Graphics Functions in C -Language&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=0,gm=0;&lt;br /&gt;initgraph(&amp;amp;gd,&amp;amp;gm,"..\\bgi");&lt;br /&gt;setcolor(GREEN);&lt;br /&gt;outtextxy((getmaxx()/2)-70,20,"GRAPHICSDEMO");&lt;br /&gt;setcolor(RED);&lt;br /&gt;circle(100,150,50);&lt;br /&gt;outtextxy(75,145,"Circle");&lt;br /&gt;line(175,150,250,150);&lt;br /&gt;outtextxy(180,160,"Line");&lt;br /&gt;fillellipse(400,150,100,50);&lt;br /&gt;setcolor(RED);&lt;br /&gt;outtextxy(375,145,"FillEllipse");&lt;br /&gt;arc(100,350,30,90,100);&lt;br /&gt;outtextxy(120,300,"Arc");&lt;br /&gt;putpixel(275,270,GREEN);&lt;br /&gt;outtextxy(255,300,"PIXEL");&lt;br /&gt;getch();&lt;br /&gt;closegraph();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;Note: include graphics.h header file&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-2925783294255752149?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/yrOZLrAa-o8/graphics-demo-in-c-langauge.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>1</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/graphics-demo-in-c-langauge.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-2832027761046149021</guid><pubDate>Sat, 17 Nov 2007 13:04:00 +0000</pubDate><atom:updated>2007-11-20T06:17:43.542-08:00</atom:updated><title>Graphics in C- Langauge</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Au8-jlAR8FJWWJsk5RwTbn6KJ4Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Au8-jlAR8FJWWJsk5RwTbn6KJ4Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Au8-jlAR8FJWWJsk5RwTbn6KJ4Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Au8-jlAR8FJWWJsk5RwTbn6KJ4Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;How to activate graphics mode in C-laguage programs using TC++ IDE ?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;Ans : TC++ IDE contain BGI(Borland Graphics Intializer) which intialises and starts Gaphics. Normally TC++ IDE runs programs in text mode. All graphics functions stored in graphics.h header file. So we have to include this header file in C or C++ programs. Main function to start graphics mode is &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3333ff;"&gt;initgraph(GraphDetect , GraphMode, "Locaton of BGI");&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;where GraphDetect is the reference to integer which is used detect/set graphics mode, default value is Zero(0) and GraphMode is gaphicsmode which is also Zero for default. &lt;/span&gt;&lt;br /&gt;To close Graphics Mode we use &lt;span style="color:#3333ff;"&gt;closegraph() &lt;/span&gt;fucntion which returns back the enviorment to text mode.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;&lt;strong&gt;First Sample Program to draw a Circle and Line in C-language &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int gd=0,gm=0; //declare gd and gm as integers&lt;br /&gt;initgraph(&amp;amp;gd,&amp;amp;gm,"..\\bgi"); //initialse gaphics system&lt;br /&gt;setcolor("RED"); //set the out color= red&lt;br /&gt;circle(100,150,50); // draw at circel at x=100 , y=150 and radius =50&lt;br /&gt;outtextxy(100,155, "Circle"); // Prints Circle at the give x,y cordiantes of screen&lt;br /&gt;line(100,150,100,250); // draw a line with cordinats x1=100, y1=150, x2=100,y20150&lt;br /&gt;outtextxy(100,120,"Line");&lt;br /&gt;getch();&lt;br /&gt;closegraph(); //close gaphics environment&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;Note : Include graphics.h header file&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-2832027761046149021?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/b29CdOVuxkQ/graphics-in-c-langauge.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/graphics-in-c-langauge.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-5063028206192020373</guid><pubDate>Fri, 16 Nov 2007 13:45:00 +0000</pubDate><atom:updated>2010-11-11T21:53:42.289-08:00</atom:updated><title>C Program to find All Prime Numbers from 1 to 100</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/cY48q7yMP8JruRIPg2XB3TAcd-Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cY48q7yMP8JruRIPg2XB3TAcd-Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/cY48q7yMP8JruRIPg2XB3TAcd-Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/cY48q7yMP8JruRIPg2XB3TAcd-Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="color: #cc0000; font-size: 130%;"&gt;&lt;b&gt;1. Program to findout all Prime Number between 1 to 100.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i,num=1;&lt;br /&gt;clrscr();&lt;br /&gt;&lt;br /&gt;while(num&amp;lt;=100)&lt;br /&gt;{ i=2; while(i&amp;lt;=num)&lt;br /&gt;{ if(num%i==0)&lt;br /&gt;break;&lt;br /&gt;i++; }&lt;br /&gt;if(i==num)&lt;br /&gt;printf("\n%d is Prime",num);&lt;br /&gt;num++;&lt;br /&gt;}&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note: You can modify the first while loop to increase the range.  &lt;br /&gt;&lt;h3&gt;  &lt;b&gt;&lt;br /&gt;Now you can check output of this program at &lt;a href="http://codepad.org/B4eMfCxI"&gt;http://codepad.org/B4eMfCxI&lt;/a&gt; &lt;/b&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-5063028206192020373?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/gs8098ljais/c-program-to-find-all-prime-number-from.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>24</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/c-program-to-find-all-prime-number-from.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-7550792577881661438</guid><pubDate>Wed, 14 Nov 2007 05:03:00 +0000</pubDate><atom:updated>2007-11-13T21:31:26.890-08:00</atom:updated><title>Timer Simulation in C-Language</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/d9l63AmAFG6k2xfwfA2NRP2rvDo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d9l63AmAFG6k2xfwfA2NRP2rvDo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/d9l63AmAFG6k2xfwfA2NRP2rvDo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/d9l63AmAFG6k2xfwfA2NRP2rvDo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;span style="font-size:180%;color:#cc0000;"&gt;Digital Timer Simulation in C-Langauge(Turbo C++) using nested for loops, delay() and clrscr()fucntions.&lt;/span&gt;&lt;/div&gt;&lt;span style="color:#000000;"&gt;&lt;p&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int sec,min,hour;&lt;br /&gt;clrscr();&lt;br /&gt;for(hour=0;sec&lt;=24;hour++)&lt;br /&gt;{&lt;br /&gt;for(min=0;min&lt;=60;min++) &lt;br /&gt;{ &lt;br /&gt;for(sec=0;sec&lt;=60;sec++) &lt;br /&gt;clrscr();&lt;br /&gt;gotoxy(12,50); //To print the text at 12th coloum and 50th row of the screen textcolor(4+128); //To set Red Color and Blink &lt;br /&gt;cprintf("Timer Simulation By Shariq Khan,Press Any Key To Exit");&lt;br /&gt;textcolor(2);&lt;br /&gt;gotoxy(30,16);&lt;br /&gt;cprintf("****************");//To print * &lt;br /&gt;gotoxy(35,18); &lt;br /&gt;cprintf("H:M:S"); &lt;br /&gt;gotoxy(35,20); &lt;br /&gt;cprintf("%d:%d:%d",hour,min,sec); &lt;br /&gt;gotoxy(30,22); &lt;br /&gt;cprintf("****************"); &lt;br /&gt;delay(1000); //To halt the execution for 1000 miliseconds(1 sec) &lt;br /&gt;if(kbhit()) //To check for any key pressed by user &lt;br /&gt;exit(1);//if key is pressed then program is stopped &lt;br /&gt;}&lt;br /&gt;} &lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="center"&gt;&lt;span style="font-size:130%;color:#cc0000;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="font-size:130%;color:#cc0000;"&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/8108645605049629138-7550792577881661438?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/eO1oGre1mEE/time-simulation-in-c-language.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/time-simulation-in-c-language.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-3301384434926260733</guid><pubDate>Mon, 12 Nov 2007 17:30:00 +0000</pubDate><atom:updated>2007-11-12T10:10:47.563-08:00</atom:updated><title>C- Language Programs</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nmEVgtWzXSwNFrm5tIreBIH4TaU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nmEVgtWzXSwNFrm5tIreBIH4TaU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nmEVgtWzXSwNFrm5tIreBIH4TaU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nmEVgtWzXSwNFrm5tIreBIH4TaU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color:#006600;"&gt;1. Finding Armstrong Number between 1 to 500 using loop. Armstrong numbers are those number whose sum of the cube of all digits eqaul to Original number&lt;br /&gt;i.e 153= (1x1x1+ 5x5x5+3x3x3)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int i, sum=0, cube,num=0,onum=0, a,b;&lt;br /&gt;clrscr();&lt;br /&gt;for(i=1;i&lt;=500;i++)&lt;br /&gt;{&lt;br /&gt;onum=i;&lt;br /&gt;num=i;&lt;br /&gt;sum=0;&lt;br /&gt;while(num!=0) {&lt;br /&gt;cube=0;&lt;br /&gt;a=num%10;&lt;br /&gt;b=num/10;&lt;br /&gt;cube=a*a*a;&lt;br /&gt;num=b;&lt;br /&gt;sum=sum+cube;&lt;br /&gt;}&lt;br /&gt;if(onum==sum)&lt;br /&gt;printf("\n %d is Armstrong Number",onum);&lt;br /&gt;}&lt;br /&gt;getch();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-3301384434926260733?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/-X-gXX0VujA/c-language-programs.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/c-language-programs.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-4912636665145491670</guid><pubDate>Thu, 01 Nov 2007 12:01:00 +0000</pubDate><atom:updated>2007-11-01T05:08:49.960-07:00</atom:updated><title>C# Codes</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dA47rUClqUfSBiZAKrcHlXTyUcY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dA47rUClqUfSBiZAKrcHlXTyUcY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dA47rUClqUfSBiZAKrcHlXTyUcY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dA47rUClqUfSBiZAKrcHlXTyUcY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="color:#cc0000;"&gt;1. How to Activate  a New Form in C# Windows Application on Clikc of Button&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private void button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;Form f1 = new Form2(); //Declaring New for f1 and assigning Form2 to it&lt;br /&gt;f1.Show();                          //Activating f1 on click of button&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-4912636665145491670?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/T77wQ9S9LA4/c-codes.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/11/c-codes.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-1452759637051466148</guid><pubDate>Mon, 29 Oct 2007 10:47:00 +0000</pubDate><atom:updated>2009-11-03T06:45:03.372-08:00</atom:updated><title>Finding Factorial of a Number in C using Function</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Zw_GHfBCGcNAhEgbpMQ4BfU24xQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zw_GHfBCGcNAhEgbpMQ4BfU24xQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Zw_GHfBCGcNAhEgbpMQ4BfU24xQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zw_GHfBCGcNAhEgbpMQ4BfU24xQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="color:#cc0000;"&gt;1. Factorial of a number usign loop&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int num;&lt;br /&gt;void factorial(int); //Prototype&lt;br /&gt;clrscr();&lt;br /&gt;printf("\n Enter the Number whose factorial is required");&lt;br /&gt;scanf("%d",&amp;amp;num);&lt;br /&gt;&lt;br /&gt;factorial(num);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void factorial(int n)&lt;br /&gt;{&lt;br /&gt;int i, fact=1;&lt;br /&gt;for(i=1;i&lt;=n;i++) fact=fact*i;  printf("Factorial of %d is= %d", n,fact); }  &lt;strong&gt;&lt;span style="color:#cc0000;"&gt;2. Finding Factorial of a number using Recursion&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int number,ans;&lt;br /&gt;clrscr();&lt;br /&gt;printf("Enter the number");&lt;br /&gt;scanf("%d",&amp;amp;number);&lt;br /&gt;ans=fact(number);&lt;br /&gt;printf("\n factorial=%d",ans);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int fact(int n)&lt;br /&gt;{&lt;br /&gt;int f;&lt;br /&gt;if(n==1)&lt;br /&gt;return (1);&lt;br /&gt;else&lt;br /&gt;f=n*fact(n-1);&lt;br /&gt;return (f);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Use long int in place of int to find factorial of large number like 100 or so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-1452759637051466148?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/CMoU3_O4iUc/finding-factorial-of-number-in-c-using.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>7</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/finding-factorial-of-number-in-c-using.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-1233354740846952556</guid><pubDate>Fri, 26 Oct 2007 07:14:00 +0000</pubDate><atom:updated>2007-10-26T00:38:38.386-07:00</atom:updated><title>Writing and Reading Objects to/from Files Using C++</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PaCepnI9Y81yhw_EeGEOevVyP0I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PaCepnI9Y81yhw_EeGEOevVyP0I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PaCepnI9Y81yhw_EeGEOevVyP0I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PaCepnI9Y81yhw_EeGEOevVyP0I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;color:#990000;"&gt;&lt;strong&gt;1. Writing an Object to Disk File&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;Note: &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;1. Include fstream.h &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;2. Use extraction and Insertion operator with cout and cin instead of ^^ .&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;class employee //Define Employee Class&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;protected:&lt;br /&gt;char name[30];&lt;br /&gt;int age;&lt;br /&gt;float salary;&lt;br /&gt;public :&lt;br /&gt;void getemp()&lt;br /&gt;{&lt;br /&gt;cout^^ "Enter Name:";&lt;br /&gt;cin^^name;&lt;br /&gt;&lt;br /&gt;cout^^"Enter Age:";&lt;br /&gt;cin^^age;&lt;br /&gt;&lt;br /&gt;cout^^"Enter Salary";&lt;br /&gt;cin^^salary;&lt;br /&gt;} ;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;employee emp; //declaring object emp of employee class&lt;br /&gt;emp.getdata();&lt;br /&gt;ofstream outfile("Emp.dat"); //create emp.dat file&lt;br /&gt;outfile.write((char * )&amp;amp;emp,sizeof(emp)); //write contents of object emp to the file&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#990000;"&gt;2. Reading Object from Disk file&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-size:100%;color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;Note : Remove getdata() from Employee class and add showdata as follows&lt;br /&gt;&lt;br /&gt;class Employee&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public:&lt;br /&gt;void showdata()&lt;br /&gt;{&lt;br /&gt;cout^^ "Name="^^name;&lt;br /&gt;cout^^ "Age="^^age;&lt;br /&gt;cout^^ "Salar="^^salary;&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#990000;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;employee emp;&lt;br /&gt;ifstream infile("Emp.dat");&lt;br /&gt;infile.read("(char*)&amp;amp;emp, sizeof(emp)); //read object from file and put into emp object&lt;br /&gt;emp.showdata();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-1233354740846952556?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/jwSAmRQlxMA/writing-and-reading-objects-to-files.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/writing-and-reading-objects-to-files.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-6383542943404987201</guid><pubDate>Wed, 24 Oct 2007 05:13:00 +0000</pubDate><atom:updated>2007-10-23T22:55:37.446-07:00</atom:updated><title>Files in C++</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/q1ardcLpzsoHNS1hKCpa75plcQQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q1ardcLpzsoHNS1hKCpa75plcQQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/q1ardcLpzsoHNS1hKCpa75plcQQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q1ardcLpzsoHNS1hKCpa75plcQQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;strong&gt;1. Writing and Reading Strings to/from Files&lt;/strong&gt;&lt;/span&gt; (Note :1. Include fstream.h 2. Use extraction operator instead of ^^ )&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;a. Wrting Strings to File&lt;/span&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;ofstream outfile("MSG.TXT"); //creates a file MSG.TX sends text to it.&lt;br /&gt;&lt;br /&gt;outfile^^ "Hello Folks !\n";&lt;br /&gt;outfile^^"Ready for your Home Work\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;b. Reading String from File&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;const int MAX=80; //Define MAX to hold line of 80 characters&lt;br /&gt;char mem[MAX]; //Array mem[MAX] ''' ''&lt;br /&gt;ifstream infile("MSG.TXT");// creates a file MSG.TXT to read text&lt;br /&gt;while(infile) //reads till end of file&lt;br /&gt;{&lt;br /&gt;infile.getline(mem,MAX); //write it to array&lt;br /&gt;cout^^mem;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;strong&gt;2. Writing and Reading Character to/from Files&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;a. Writing Characters to a file&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;char str[]= "Think of Devil and Devi is here\n";&lt;br /&gt;ofstream outfile("NEWMSG.TXT");&lt;br /&gt;for(int i=0;i^strlen(str);i++)&lt;br /&gt;outfile.put(str[j]);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;b. Reading Characters from a file&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;br /&gt;char ch;&lt;br /&gt;ifstream infile("NEWMSG.TXT");&lt;br /&gt;while(infile)&lt;br /&gt;{&lt;br /&gt;infile.getch();&lt;br /&gt;cout^^ ch;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;Note : Use Extraction Operator instead of ^^ and Less than operator instead of ^.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-6383542943404987201?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/hlcUxt_Bkzw/files-in-c.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/files-in-c.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-5358882323760914265</guid><pubDate>Tue, 23 Oct 2007 06:47:00 +0000</pubDate><atom:updated>2007-10-23T00:46:04.568-07:00</atom:updated><title>Some File Handling Programes in C</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YRmfzlILQ97HdytedTo6wzxiyqA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YRmfzlILQ97HdytedTo6wzxiyqA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YRmfzlILQ97HdytedTo6wzxiyqA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YRmfzlILQ97HdytedTo6wzxiyqA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;strong&gt;1. Count Characters, spaces, tabs and lines in a file&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;main()&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;FILE *fp; //a pointer to file&lt;br /&gt;char ch;&lt;br /&gt;int nol=0,not=0,nos=0;nos=0;&lt;br /&gt;fp=fopen("test.c","r"); //open file test.c in read only mode&lt;br /&gt;&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;ch=fgetc(fp); //read each character of file in ch using pointer file pointer fp&lt;br /&gt;&lt;br /&gt;if(ch==EOF) //if end of file in reached&lt;br /&gt;break;&lt;br /&gt;noc++; //count number of characters&lt;br /&gt;&lt;br /&gt;if(ch==' ') //if space is read into ch increase its count&lt;br /&gt;nos++;&lt;br /&gt;&lt;br /&gt;if(ch='\n') //if new line is read into ch increase its count&lt;br /&gt;nol++;&lt;br /&gt;&lt;br /&gt;if(ch=='\t') //if tab is read increase its count&lt;br /&gt;not++;&lt;br /&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;fclose(fp); //close file&lt;br /&gt;&lt;br /&gt;printf("\n Number of Cahracters=%d",noc);&lt;br /&gt;printf("\n Number of Spaces =%d",nos);&lt;br /&gt;printf("\n Number of Tabs=%d",not);&lt;br /&gt;printf("\n Number of Lines=%d",nol);&lt;br /&gt;&lt;br /&gt;gecth();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#000000;"&gt;-----------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;strong&gt;2. Copying a File&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;FILE *fs, *ft; //fs is a pointer to source file and ft is a pointer to destination file&lt;br /&gt;char ch;&lt;br /&gt;&lt;br /&gt;fs=fopen("source.txt", "r"); //open source.txt in read only mode&lt;br /&gt;&lt;br /&gt;if(fs==NULL)&lt;br /&gt;{&lt;br /&gt;puts("Source file not found");&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ft=fopen("dest.txt", "w") // open dest.txt file in write mode&lt;br /&gt;&lt;br /&gt;if(ft==NULL)&lt;br /&gt;{&lt;br /&gt;puts("Unable to Open Target File");&lt;br /&gt;fclose(fs);&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;ch=fetch(ch);&lt;br /&gt;&lt;br /&gt;if(ch==EOF)&lt;br /&gt;break;&lt;br /&gt;else&lt;br /&gt;fputc(ch,ft);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;fclose(fp);&lt;br /&gt;fclose(ft);&lt;br /&gt;&lt;br /&gt;puts("File Copied Succesfully");&lt;br /&gt;gecth();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#009900;"&gt;Immitating DOS Copy Command using above program&lt;br /&gt;We can use command line arguments in above program to make a DOS Copy command. Name the program as MCOPY.C&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;FILE *fs, *ft; //fs is a pointer to source file and ft is a pointer to destination file&lt;br /&gt;char ch;&lt;br /&gt;&lt;br /&gt;if(argc!=3)&lt;br /&gt;{&lt;br /&gt;puts("Insufficient Arguments use MCOPY [source] [destination]");&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;fs=fopen(argv[1], "r"); //open source.txt in read only mode&lt;br /&gt;if(fs==NULL)&lt;br /&gt;{&lt;br /&gt;puts("Source file not found");&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;ft=fopen(argv[2], "w") // open dest.txt file in write mode&lt;br /&gt;if(ft==NULL)&lt;br /&gt;{&lt;br /&gt;puts("Unable to Open Target File");&lt;br /&gt;fclose(fs);&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;ch=fetch(ch);&lt;br /&gt;if(ch==EOF)&lt;br /&gt;break;&lt;br /&gt;else&lt;br /&gt;fputc(ch,ft);&lt;br /&gt;}&lt;br /&gt;fclose(fp);&lt;br /&gt;fclose(ft);&lt;br /&gt;puts("File Copied Succesfully");&lt;br /&gt;gecth();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To run above program go to the Command Prompt or DOS shell and use the following command format MCOPY [SOURCEFILE] [DESTFILE] where SOURCEFILE is the name of source file and DESTFILE is the name of destination file.&lt;br /&gt;------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#009900;"&gt;3. Writing Files using String I/O functions&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;main()&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt; FILE *fp;&lt;br /&gt;char s[80];&lt;br /&gt;&lt;br /&gt;fp=fopen("MSG.TXT", "W");&lt;br /&gt;&lt;br /&gt;if(fp==NULL)&lt;br /&gt;{&lt;br /&gt;  puts("Unable To  Open  File");&lt;br /&gt;exit(1);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;printf("\n Enter the Message \n");&lt;br /&gt;while(strlen(gets(s)&gt;0) // to terminae program press enter without typing anything on newline&lt;br /&gt;{&lt;br /&gt;  fputs(s,fp); // write contents of array s to the file fp&lt;br /&gt; fputs("\n");  // writes new line to the file&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;fclose(fp);&lt;br /&gt;puts("Message is Saved Successfully");&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Note : To see the contents of newly created MSG.TXT use DOS TYPE Command.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#000000;"&gt;or Write Following Program&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;-----------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;color:#009900;"&gt;4. Reading Strings from FILE using String I/O&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:100%;color:#000000;"&gt;&lt;/span&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;  FILE *fp;&lt;br /&gt;char s[80];&lt;br /&gt; fp=fopen("MSG.TXT", "r");&lt;br /&gt; if(fp==NUL)&lt;br /&gt;{&lt;br /&gt;   puts("File not found");&lt;br /&gt;  exit(1);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;while(fgets(s,79,fp)!=NULL) //Read the contents of file 80 chars at a time and put in aray "s"   &lt;br /&gt;                                                       untill reached to NULL Characte(end of file)&lt;br /&gt;  printf("%s",s);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;fclose(fp);&lt;br /&gt;&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#009900;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-5358882323760914265?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/FSSEBOxltXo/some-file-handling-programes-in-c.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/some-file-handling-programes-in-c.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-3048816226958236639</guid><pubDate>Mon, 15 Oct 2007 08:27:00 +0000</pubDate><atom:updated>2007-10-15T01:37:09.956-07:00</atom:updated><title>File Handling in C++</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dgYvzjvPsX1RE8ue4bJpD_L5Rm4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dgYvzjvPsX1RE8ue4bJpD_L5Rm4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dgYvzjvPsX1RE8ue4bJpD_L5Rm4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dgYvzjvPsX1RE8ue4bJpD_L5Rm4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="color:#3366ff;"&gt;&lt;strong&gt;Counting Words, Paragraphs  and Lines in Disk File using command line arguments(C++)&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;int main(int argc, char *argv[])&lt;br /&gt;{&lt;br /&gt;ifstream infile;&lt;br /&gt;bool flag =false;&lt;br /&gt;bool paraFlag = false;&lt;br /&gt;char c;&lt;br /&gt;int words = 0;&lt;br /&gt;int lines = 0;&lt;br /&gt;int paragraphs = 0;&lt;br /&gt;infile.open(argv[1]);&lt;br /&gt; c = infile.get();&lt;br /&gt;while (!infile.eof())&lt;br /&gt;{&lt;br /&gt;while (c != '\n')&lt;br /&gt;{if ((c &gt;= 'a' &amp;amp;&amp;amp; c &lt;= 'z')  (c &gt;= 'A' &amp;amp;&amp;amp; c &lt;= 'Z'))&lt;br /&gt;{&lt;br /&gt;if (!flag)&lt;br /&gt;{&lt;br /&gt;words++;&lt;br /&gt;flag = true;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;flag = false;&lt;br /&gt;c = infile.get();&lt;br /&gt;}&lt;br /&gt;if (c == '\n')&lt;br /&gt;{&lt;br /&gt;lines++;&lt;br /&gt;if (!paraFlag)&lt;br /&gt;{&lt;br /&gt; paragraphs++;&lt;br /&gt;paraFlag = true;&lt;br /&gt;}&lt;br /&gt;c = infile.get();&lt;br /&gt;while (c == '\n')&lt;br /&gt;{&lt;br /&gt; lines++;&lt;br /&gt;paraFlag = false;&lt;br /&gt; c = infile.get();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;cout ^^ " Words in File "^^ words ^^ endl;&lt;br /&gt;cout ^^ " Lines in File " ^^ lines ^^ endl;&lt;br /&gt;cout ^^ " Paragraps in File " ^^ paragraphs ^^ endl;&lt;br /&gt;infile.close();&lt;br /&gt;getch();&lt;br /&gt;return 0;&lt;br /&gt;}&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-3048816226958236639?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/Fwq85ROVP7E/file-handling-in-c.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/file-handling-in-c.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-821617129806732773</guid><pubDate>Sun, 14 Oct 2007 22:56:00 +0000</pubDate><atom:updated>2007-10-14T16:50:52.308-07:00</atom:updated><title>Answers of  Computer Related Problems</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ecpe8oa6V7E98xtIegSHVZMkdes/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ecpe8oa6V7E98xtIegSHVZMkdes/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ecpe8oa6V7E98xtIegSHVZMkdes/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ecpe8oa6V7E98xtIegSHVZMkdes/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q. What is BIOS&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ans - The full form of BIOS is Basic Input Output System and it is not related to Biotech field. It is related to computer system and responsible to start computer and hold inforamtion and settings about all the hardware devices attached to the computer.&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q. How to access individual grid variables(Cloumns) in ASP.Net GridView using C#&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ans- String name;&lt;/p&gt;&lt;p&gt;name=dSet.rows[0].coloum["Name"];&lt;/p&gt;&lt;p&gt;now you can use it to check for specific value like&lt;/p&gt;&lt;p&gt;if(name=="John")&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;//your code&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q. During linked list creation a=(node*)malloc(size of node) means?(C/C++)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ans - Malloc() allocates memory dynamically i.e at run time only when it is required. It is used in creation of linked lists(dynamic) and ques(dynamic).in your statementnode * means - a ponter to the node of linklist/que etcsize of node - means eqaul to size of node i.e a address of variable+ value.&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q. What is URL.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ans- The fullform of URL is Univarsal Resource Locator and its very common example is web site address &lt;a href="http://www.hotmail.com/" rel="nofollow"&gt;http://www.hotmail.com/&lt;/a&gt; (this is a URL). You can see that besides hotmail some other terms are here1. http - i.e Hyper Text Transmission Protoco:- This is a set of rules which is used to send and recive information on the Internet.2. www - i.e World Wide Web : a term used for millions of interconnected computer on the Internet3. com : i.e a domain which show the domain(group) of website.4. hotmail i.e a server/site name all four are pointed to a certain IP(Internet Protocol) address which uniquely indentify computers of Internet. This is someting like 192.144.145.98 and pointed by &lt;a href="http://www.xyz.com/" rel="nofollow"&gt;http://www.xyz.com/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Q. &lt;span style="color:#3366ff;"&gt;Write a C++ function with a 1Dinteger array as its input parameter, that returns both the largest and thesmallest number in that array. Also show the corresponding function call.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Ans -&lt;/p&gt;&lt;p&gt;void main()&lt;/p&gt;&lt;p&gt;{int ar[10],i;&lt;/p&gt;&lt;p&gt;clrscr();&lt;/p&gt;&lt;p&gt;void getminmax(int[]);&lt;/p&gt;&lt;p&gt;cout&lt;&lt;"\n Enter the elements";&lt;/p&gt;&lt;p&gt;for(i=1;i&lt;=5;i++)&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;cin&gt;&gt;ar[i];&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;getminmax(ar);&lt;/p&gt;&lt;p&gt;getch();&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;void getminmax(int x[])&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;int i,j,k,t;for(i=0;i&lt;=5;i++)&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;for(j=i+1;j&lt;=5;j++)&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;if(x[i]&gt;x[j])&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;t=x[i];x[i]=x[j];x[j]=t;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;cout&lt;span style="color:#ff0000;"&gt;^^&lt;/span&gt;"\n Largest Number is"&lt;span style="color:#ff0000;"&gt;^^&lt;/span&gt;x[4];&lt;/p&gt;&lt;p&gt;cout^^"\n Smallest Number is"&lt;span style="color:#ff0000;"&gt;^^&lt;/span&gt;x[0];&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;&lt;span style="color:#ff0000;"&gt;Note: Use Extraction Operators instead of ^^ .&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q. Is it possible to work with C++ or similar programming languages on LINUX?&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;Ans. Yes, you can get inbuilt compilers and IDE' s for that C, C++, Java. You can also use Eclipse on Linux. Oracle is also available on Linux.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#3366ff;"&gt;Q.'Column&lt;/span&gt;&lt;span style="color:#3366ff;"&gt; A' and 'column B' should be added in 'column C'.  write a formula for entire column at a time , so that, you need not to write formula for every row. As we do format a entire column, is there any possibility to write formula for entire column? If you know, pl help me out.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;Ans-Enter formula as an array. To do so select column C from top to bottom adjacent to A and B then type formula for whole range of A and B like =A1:A20+B1:B20 and then press Ctrl+ENTER, this adds c1=a1+b1, c2=a2+b2 ....................&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-821617129806732773?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/u1Xo8a_ca0Y/answers-of-computer-related-problems.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>1</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/answers-of-computer-related-problems.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-6977841881865192052</guid><pubDate>Thu, 11 Oct 2007 21:33:00 +0000</pubDate><atom:updated>2007-10-14T15:56:32.872-07:00</atom:updated><title>Some more Codes and  Answers</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R2qEeYHFubOUNdwlVf1ubqHuJ3k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R2qEeYHFubOUNdwlVf1ubqHuJ3k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R2qEeYHFubOUNdwlVf1ubqHuJ3k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R2qEeYHFubOUNdwlVf1ubqHuJ3k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;span style="color:#3366ff;"&gt;1. Proram to Convert Decimal To Binary and Print It(C-Lang)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int a=0,b=0,n,i=1,j,k=0;&lt;br /&gt;int ar[10]={0,0,0,0,0,0,0,0,0,0};&lt;br /&gt;clrscr();&lt;br /&gt;printf("\n Enter the decimal number");&lt;br /&gt;scanf("%d",&amp;amp;n);&lt;br /&gt;while(n!=0)&lt;br /&gt;{&lt;br /&gt;a=n%2;&lt;br /&gt;b=n/2;&lt;br /&gt;ar[i++]=a;&lt;br /&gt;n=b;k++;&lt;br /&gt;}&lt;br /&gt;for(j=k+1;j&gt;=1;j--)&lt;br /&gt;printf("%d",ar[j]);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;2. A function to sort three number entered by the user( C++)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt;&lt;br /&gt;void sort(int a, int b , int c)&lt;br /&gt;{&lt;br /&gt;int t;&lt;br /&gt;if (a&gt;b)&lt;br /&gt;{&lt;br /&gt;t=b;b=a;a=t;&lt;br /&gt;}&lt;br /&gt;if (a&gt;c)&lt;br /&gt;{&lt;br /&gt;t=c;c=a;a=t;&lt;br /&gt;}&lt;br /&gt;if (b&gt;c)&lt;br /&gt;{&lt;br /&gt;t=b;b=c;c=t;&lt;br /&gt;}&lt;br /&gt;cout^^a^^b^^c;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Note : Extraction Operators are not working due to HTML tags, so I use ^^ instead of them&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-6977841881865192052?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/Bxuqnh9cT3k/some-more-codes-and-answers.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>0</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/some-more-codes-and-answers.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8108645605049629138.post-1571044183079434601</guid><pubDate>Thu, 11 Oct 2007 09:14:00 +0000</pubDate><atom:updated>2007-10-11T14:28:52.038-07:00</atom:updated><title>Codes By Shariq Khan</title><description>
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XDhSpAVPY7idbuviqgOFexahg1Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XDhSpAVPY7idbuviqgOFexahg1Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XDhSpAVPY7idbuviqgOFexahg1Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XDhSpAVPY7idbuviqgOFexahg1Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div align="center"&gt;&lt;span style="font-size:180%;color:#3366ff;"&gt;Codes By Shariq Khan&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;This is a one stop place for new Computer Programmers and Students who want to learn C, C++, Java, C#, VB, C++,ASP.Net and many more. I will regularly post new programmes and code to help them to find the solution of the problems. Also I request all the visitors of this blog to post the codes, solutions of problems realted to above programming langauges. We will also provide project guidance, exam help, model test/question papers to the student of BE, B.Sc, BCA,BIT, B.Com(CA), PGDCA, MCM, MCA, DOEACC 'O', 'A', 'B', 'C' Levels. All intreseted experts, contributers are welcome to join this blog.&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span style="color:#990000;"&gt;Thank You&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;Your's truly&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;Shariq Khan&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;B.Sc, DOEACC 'A' Level&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#990000;"&gt;Indore&lt;/span&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="font-size:130%;color:#009900;"&gt;------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="font-size:130%;color:#009900;"&gt;Some Useful C and C++ Codes&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="font-size:130%;color:#009900;"&gt;------------------------------------------------------------------------&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3333ff;"&gt;1. Fibonacci Sequence of nth terms without Recursion( in C-lang)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;stdio.h&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;long int n,a=0,b=1,c=1,i;&lt;br /&gt;clrscr();&lt;br /&gt;printf("\nEnter Nth term");&lt;br /&gt;scanf("%ld",&amp;amp;n);&lt;br /&gt;for(i=1;i&lt;=n;i++) &lt;/div&gt;&lt;div align="left"&gt;{ printf("\n%ld",c); &lt;/div&gt;&lt;div align="left"&gt;c=a+b;&lt;/div&gt;&lt;div align="left"&gt;a=b;&lt;/div&gt;&lt;div align="left"&gt;b=c;&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;getch(); &lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;---------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;2. Swaping of values of two varibales without using third variable(in C- Lang)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;void main()&lt;/div&gt;&lt;div align="left"&gt;{&lt;/div&gt;&lt;div align="left"&gt;int a,b;&lt;/div&gt;&lt;div align="left"&gt;clrscr();&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;printf("\n Enter the value of First Variable a:");&lt;/div&gt;&lt;div align="left"&gt;scanf("%d", &amp;amp;a);&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;printf("\n Enter the value of Second Variable b:");&lt;/div&gt;&lt;div align="left"&gt;scanf("%d" &amp;amp;b);&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;a=a+b;&lt;br /&gt;b=a-b;&lt;br /&gt;a=a-b;&lt;br /&gt;printf("\n a=%d,b=%d",a,b);&lt;br /&gt;getch();&lt;/div&gt;&lt;div align="left"&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3333ff;"&gt;3. Sum of the digits of n digit number (in C-lang)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3333ff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#000000;"&gt;void main()&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;{&lt;/div&gt;&lt;div align="left"&gt;long int num, a,b,sum=0;&lt;/div&gt;&lt;div align="left"&gt;clrscr();&lt;/div&gt;&lt;div align="left"&gt;printf("\n Enter the number :");&lt;/div&gt;&lt;div align="left"&gt;scanf("%ld",&amp;amp;num);&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;while(num!=0)&lt;/div&gt;&lt;div align="left"&gt;{&lt;/div&gt;&lt;div align="left"&gt;a=num%10;&lt;/div&gt;&lt;div align="left"&gt;b=num/10;&lt;/div&gt;&lt;div align="left"&gt;sum=a+sum;&lt;/div&gt;&lt;div align="left"&gt;num=b;&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;printf("\n Sum of the digit of number is=%ld",sum);&lt;/div&gt;&lt;div align="left"&gt;getch();&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;4. Largest and Smallest number in a One Dimesional Array using function&lt;/span&gt;&lt;span style="color:#3366ff;"&gt;( in C++)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;iostream.h&gt;&lt;conio.h&gt;&lt;div align="left"&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int ar[10],i;&lt;br /&gt;clrscr();&lt;br /&gt;void getminmax(int[]);&lt;br /&gt;cout&lt;&lt;"\n Enter the elements"; for(i=1;i&lt;=5;i++) { cin&gt;&gt;ar[i];&lt;br /&gt;}&lt;br /&gt;getminmax(ar);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;void getminmax(int x[])&lt;br /&gt;{&lt;br /&gt;int i,j,k,t;&lt;br /&gt;for(i=0;i&lt;=5;i++) &lt;/div&gt;&lt;div align="left"&gt;{ for(j=i+1;j&lt;=5;j++)&lt;/div&gt;&lt;div align="left"&gt;{ if(x[i]&gt;x[j])&lt;br /&gt;{&lt;br /&gt;t=x[i];&lt;br /&gt;x[i]=x[j];&lt;br /&gt;x[j]=t;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;cout"\n Largest Number is"^^x[4];&lt;br /&gt;cout"\n Smallest Number is"^^coutx[0];&lt;br /&gt;}&lt;br /&gt;Note:please use cout statement with extraction operator, (I am using ^^ ) to print x[4] and x[0] i.e largest and smallest number in an array. I am unable to use extraction operator because of HTML tags &lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;5. Linked List (C- Lang)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;void insert();&lt;br /&gt;void display();&lt;br /&gt;void del();&lt;br /&gt;struct link&lt;br /&gt;{&lt;br /&gt;int info;&lt;br /&gt;struct link *next;&lt;br /&gt;}*start,*nodepr,*nodenx,*nodecr;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int ch,x;&lt;br /&gt;clrscr();&lt;br /&gt;start=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;start=NULL;&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;printf("\n 1. INSERT");&lt;br /&gt;printf("\n 2. DELETE");&lt;br /&gt;printf("\n 3. DISPLAY");&lt;br /&gt;printf("\n 4. EXIT");&lt;br /&gt;printf("\n Enter Your Choice");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1: insert();&lt;br /&gt;break;&lt;br /&gt;case 2: del();&lt;br /&gt;break;&lt;br /&gt;case 3: display();&lt;br /&gt;break;&lt;br /&gt;case 4: exit(1);&lt;br /&gt;default:printf("\n Invalid Choice");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;void insert(x)&lt;br /&gt;{&lt;br /&gt;int i=0;&lt;br /&gt;nodecr=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;nodenx=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;nodepr=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;printf("\n Enter the number");&lt;br /&gt;scanf("%d",&amp;amp;x);&lt;br /&gt;nodecr-&gt;info=x;&lt;br /&gt;nodenx=start;&lt;br /&gt;nodecr-&gt;next=NULL;&lt;br /&gt;if(start==NULL)&lt;br /&gt;start=nodecr;&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;while((nodenx-&gt;info&lt;x)&amp;amp;&amp;amp;(nodenx!=null)) nodenx="nodenx-" nodepr="nodenx;"&gt;next;&lt;br /&gt;}&lt;br /&gt;if((nodepr-&gt;info)&lt;x)&gt;next=nodenx;&lt;br /&gt;nodepr-&gt;next=nodecr;&lt;br /&gt;if(i==0)&lt;br /&gt;{&lt;br /&gt;nodecr-&gt;next=nodenx;&lt;br /&gt;start=nodecr;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;void display()&lt;br /&gt;{&lt;br /&gt;nodecr=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;nodecr=start;&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;printf("\n %d",nodecr-&gt;info);&lt;br /&gt;nodecr=nodecr-&gt;next;&lt;br /&gt;}while(nodecr!=NULL);&lt;br /&gt;getch();&lt;br /&gt;}&lt;br /&gt;void del()&lt;br /&gt;{&lt;br /&gt;nodecr=(struct link*)malloc( sizeof(struct link));&lt;br /&gt;nodecr=start;&lt;br /&gt;if(start==NULL)&lt;br /&gt;start=nodecr;&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;start=nodecr-&gt;next;&lt;br /&gt;nodecr=start;&lt;br /&gt;}&lt;br /&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;6. Queues Using Array(C-Lang)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;stdio.h&gt;&lt;conio.h&gt;void main()&lt;br /&gt;{&lt;br /&gt;int ar[12],i=0,j,ch;&lt;br /&gt;clrscr();&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;//clrscr();&lt;br /&gt;printf("\n Enter Your Choice from the following");&lt;br /&gt;printf("\n 1. Insert");&lt;br /&gt;printf("\n 2. Delete");&lt;br /&gt;printf("\n 3. Display");&lt;br /&gt;printf("\n 4. Quit");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1:&lt;br /&gt;if(i&lt;10) j="++i;"&gt;0)&lt;br /&gt;i++;&lt;br /&gt;else&lt;br /&gt;printf("\n Queue is Empty");&lt;br /&gt;break;&lt;br /&gt;case 3:&lt;br /&gt;printf("\n Queue Contains..");&lt;br /&gt;for(j=i;j&lt;10;j++)&lt;/div&gt;&lt;div align="left"&gt;printf("\n%d",ar[j]); &lt;/div&gt;&lt;div align="left"&gt;break; &lt;/div&gt;&lt;div align="left"&gt;case 4: exit(1); &lt;/div&gt;&lt;div align="left"&gt;default: &lt;/div&gt;&lt;div align="left"&gt;printf("Invalid Choice"); &lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;getch();&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;7. Stack Using Arrays(C-Lang)&lt;/span&gt;&lt;stdio.h&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int ar[12],i=0,j,ch;&lt;br /&gt;clrscr();&lt;br /&gt;while(1)&lt;br /&gt;{&lt;br /&gt;//clrscr();&lt;br /&gt;printf("\n Enter Your Choice from the following");&lt;br /&gt;printf("\n 1 .Push");&lt;br /&gt;printf("\n 2. Pop");&lt;br /&gt;printf("\n 3. Display");&lt;br /&gt;printf("\n 4. Quit");&lt;br /&gt;scanf("%d",&amp;amp;ch);&lt;br /&gt;switch(ch)&lt;br /&gt;{&lt;br /&gt;case 1:&lt;br /&gt;if(i&lt;10) j="++i;"&gt;0)&lt;br /&gt;j--;&lt;br /&gt;else&lt;br /&gt;printf("\n Stack is Empty");&lt;br /&gt;break;&lt;br /&gt;case 3:&lt;br /&gt;printf("\n Stack Contains..");&lt;br /&gt;&lt;j;i++)&gt;for(i=0;i&lt;j;i++)&gt; &lt;div align="left"&gt;printf("\n%d",ar[i]); &lt;/div&gt;&lt;div align="left"&gt;break; &lt;/div&gt;&lt;div align="left"&gt;case 4: exit(1); &lt;/div&gt;&lt;div align="left"&gt;default: &lt;/div&gt;&lt;div align="left"&gt;printf("Invalid Choice"); &lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;}getch();&lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;8. Use Of Structures(C-Lang)&lt;/span&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;stdio.h&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="left"&gt;struct book&lt;br /&gt;{&lt;br /&gt;char name[15];&lt;br /&gt;int no;&lt;br /&gt;struct writer&lt;br /&gt;{&lt;br /&gt;char author[10];&lt;br /&gt;int code;&lt;br /&gt;struct book b1;&lt;br /&gt;};&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;struct writer w;&lt;br /&gt;printf("enter the details");&lt;br /&gt;scanf("%s%s%d%d",w.b1.name,w.author,&amp;amp;w.b1.no,&amp;amp;w.code);&lt;br /&gt;printf("\n%s%s%d%d",w.b1.name,w.author,w.b1.no,w.code);&lt;br /&gt;getch();&lt;br /&gt;} &lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;------------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;9. 2D Array Input Demo(C-Lang)&lt;/span&gt; &lt;/div&gt;&lt;div align="left"&gt;&lt;br /&gt;&lt;stdio.h&gt;&lt;br /&gt;void main()&lt;br /&gt;{&lt;br /&gt;int ar[2][2],i,j;&lt;br /&gt;clrscr();&lt;br /&gt;printf("enter the elemnts");&lt;br /&gt;for(i=0;i&lt;=2;i++)&lt;/div&gt;&lt;div align="left"&gt;for(j=0;j&lt;=2;j++) &lt;/div&gt;&lt;div align="left"&gt;scanf("%d",&amp;amp;ar[i][j]);&lt;/div&gt;&lt;div align="left"&gt;for(i=0;i&lt;=2;i++) &lt;/div&gt;&lt;div align="left"&gt;for(j=0;j&lt;=2;j++) &lt;/div&gt;&lt;div align="left"&gt;printf("%2d",ar[i][j]); &lt;/div&gt;&lt;div align="left"&gt;getch(); &lt;/div&gt;&lt;div align="left"&gt;}&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;div align="left"&gt;-----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;10. Number Pyramid/Triangle(C-Lang)&lt;/span&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;span style="color:#3366ff;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;div align="left"&gt;void main()  &lt;/div&gt;&lt;div align="left"&gt;{   &lt;/div&gt;&lt;div align="left"&gt; int i,j,k,n;    &lt;/div&gt;&lt;div align="left"&gt;clrscr();    &lt;/div&gt;&lt;br /&gt;for(i=1;i&lt;10;i++)&gt;&lt;div align="left"&gt; {      &lt;/div&gt;&lt;div align="left"&gt;      printf("\n");    &lt;/div&gt;&lt;br /&gt;for(j=i;j&lt;9;j++)&gt;&lt;div align="left"&gt;         {    &lt;/div&gt;&lt;div align="left"&gt;               printf("  ");    &lt;/div&gt;&lt;div align="left"&gt;               printf("%d",i);     &lt;/div&gt;&lt;div align="left"&gt;          }    &lt;/div&gt;&lt;div align="left"&gt; } &lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;for(i=1;i&lt;10;i++)&lt;br /&gt;{&lt;br /&gt;printf("\n");&lt;br /&gt;for(j=i;j&lt;9;j++)&lt;br /&gt;{&lt;br /&gt;printf(" ");&lt;br /&gt;printf("%d",j-1);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;for(i=1;i&lt;10;i++)&lt;br /&gt;{&lt;br /&gt;printf("\n");&lt;br /&gt;for(j=i;j&lt;9;j++)&lt;br /&gt;{&lt;br /&gt;printf(" ");&lt;br /&gt;printf("%d",j+i);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;getch();&lt;br /&gt;}&lt;/div&gt;&lt;div align="left"&gt; &lt;/div&gt;&lt;div align="left"&gt;----------------------------------------------------------------------------------------------&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8108645605049629138-1571044183079434601?l=codesbyshariq.blogspot.com' alt='' /&gt;&lt;/div&gt;</description><link>http://feedproxy.google.com/~r/blogspot/codesbyshariq/~3/xi0iIs8rvjA/codes-by-shariq-khan.html</link><author>noreply@blogger.com (Shariq Khan)</author><thr:total>2</thr:total><feedburner:origLink>http://codesbyshariq.blogspot.com/2007/10/codes-by-shariq-khan.html</feedburner:origLink></item></channel></rss>

