tag:blogger.com,1999:blog-87228370983513651502024-03-07T20:27:53.368-08:00C ProgrammingBlog contains code, faq, links.
<br><br>
<big><b>
To Get huge collection of C, C++, Java, VB, Data Structure, Graphics :: SourceCode, article, links, video, faq :: Logon to <a href="http://www.EasyTutor.2ya.com">www.EasyTutor.2ya.com</a>
</b></big>EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comBlogger50125tag:blogger.com,1999:blog-8722837098351365150.post-71464663249327156952007-04-08T17:51:00.000-07:002012-10-20T12:04:30.985-07:00C Programming Links<ol>
<li style="font-weight: bold;"><div style="font-weight: normal;">
If you are looking for C++ Programming Tutorial Sites than visits following links</div>
<ul style="font-weight: normal;">
<li><a href="http://www.dailyfreecode.com/Tutorial_Simple_CPP-16/Data-File-Structure-214.aspx" target="_blank">C++ Homework Help</a></li>
<li><a href="http://www.dailyfreecode.com/Tutorial_Simple_CPP-16/Data-File-Structure-214.aspx" target="_blank">C++ Programs for Data File Structure (DFS)</a></li>
<li><a href="http://www.dailyfreecode.com/Tutorial_Simple_CPP-16/Computer-Graphics-215.aspx" target="_blank">C++ Programs for Computer Graphics</a></li>
<li><a href="http://www.dailyfreecode.com/Tutorial_Simple_CPP-16/Projects-216.aspx" target="_blank">C++ Projects</a></li>
<li><a href="http://www.dailyfreecode.com/Tutorial/Easy-CPP-16.aspx" target="_blank">C++ Programming Code bank</a></li>
</ul>
</li>
<li style="font-weight: bold;"><a href="http://www.easytutor.2ya.com/" style="font-weight: bold;">EasyTutor.2ya.com</a>: <big><b> </b><span style="font-size: 100%; font-weight: normal;">To Get huge collection of C, C++, Java, VB, Data Structure, Graphics :: SourceCode, article, links, video, faq :: Logon to <a href="http://www.easytutor.2ya.com/">www.EasyTutor.2ya.com</a></span></big></li>
<li><a href="http://www.mts-home.cjb.net/"><span style="font-weight: bold;">Muhammad Tashir Shahzad</span></a>: If you are student and looking a source-codes to complete your assignments, or interested in c/c++/assembly/vb/java codes... than you will find plenty of codes to clear you fundas... go for it <a href="http://www.mts-home.cjb.net/">http://www.mts-home.cjb.net/</a></li>
<li style="font-weight: bold;"><a href="http://www.cprogramming.com/" target="a">C Programming dot Com:</a><span style="font-weight: normal;"> It also provide you with tutorials for cprogramming and conceptual help. <a href="http://www.cprogramming.com/">http://www.cprogramming.com</a></span></li>
<li style="font-weight: bold;"><span style="font-weight: normal;"><a href="http://www.cprogramming.com/"><span style="font-weight: bold;"></span></a></span><a href="http://www.planet-source-code.com/" target="a">Planet-Source-Code.com (PSC)</a><a href="http://www.planet-source-code.com/" target="a">:</a><span style="font-weight: normal;"> </span><span style="font-weight: normal;">If you are looking for specific source-code...than log-on to this website it provides you and user friendly search environment to search and locate your required source-code...note their are plenty of source-code available on this website the thing is that you should know how to apply search and get your required source-code.</span><span style="font-weight: normal;"> <a href="http://www.planet-source-code.com/">http://www.planet-source-code.com/</a></span></li>
<li style="font-weight: bold;"><a href="http://programmersheaven.com/" target="a">ProgrammersHeaven.com</a>: <span style="font-weight: normal;">This website is similar to PSC, here you will find some nice source-code...as it is efficiently maintained and update @ regular interval of time by the web-master. <a href="http://programmersheaven.com/">http://</a></span><a href="http://programmersheaven.com/" style="font-weight: normal;" target="a">ProgrammersHeaven.com</a></li>
</ol>
EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-3957280388605437982007-04-08T15:21:00.000-07:002007-04-08T15:23:48.367-07:00FAQ : C Programming<span style="font-weight:bold;">Interview Questions for C Programming<br /></span><br />1. What does static variable mean? <br />2. What is a pointer? <br />3. What is a structure? <br />4. What are the differences between structures and arrays? <br />5. In header files whether functions are declared or defined? <br />6. What are the differences between malloc() and calloc()? <br />7. What are macros? what are its advantages and disadvantages? <br />8. Difference between pass by reference and pass by value? <br />9. What is static identifier? <br />10. Where are the auto variables stored? <br />11. Where do global, static, local, register variables, free <br />memory and C Program instructions get stored? <br />12. Difference between arrays and linked list? <br />13. What are enumerations? <br />14. Describe about storage allocation and scope of global, <br />extern, static, local and register variables? <br />15. What are register variables? What are the advantages of using <br />register variables? <br />16. What is the use of typedef? <br />17. Can we specify variable field width in a scanf() format <br />string? If possible how? <br />18. Out of fgets() and gets() which function is safe to use and <br />why? <br />19. Difference between strdup and strcpy? <br />20. What is recursion? <br />21. Differentiate between a for loop and a while loop? What are <br />it uses? <br />22. What are the different storage classes in C? <br />23. Write down the equivalent pointer _expression for referring <br />the same element a[i][j][k][l]? <br />24. What is difference between Structure and Unions? <br />25. What the advantages of using Unions? <br />26. What are the advantages of using pointers in a program? <br />27. What is the difference between Strings and Arrays? <br />28. In a header file whether functions are declared or defined? <br />29. What is a far pointer? where we use it? <br />30. How will you declare an array of three function pointers <br />where each function receives two ints and returns a float? <br />31. what is a NULL Pointer? Whether it is same as an <br />uninitialized pointer? <br />32. What is a NULL Macro? What is the difference between a NULL <br />Pointer and a NULL Macro? <br />33. What does the error 'Null Pointer Assignment' mean and what <br />causes this error? <br />34. What is near, far and huge pointers? How many bytes are <br />occupied by them? <br />35. How would you obtain segment and offset addresses from a far <br />address of a memory location? <br />36. Are the expressions arr and &arr same for an array of <br />integers? <br />37. Does mentioning the array name gives the base address in all <br />the contexts? <br />38. Explain one method to process an entire string as one unit? <br />39. What is the similarity between a Structure, Union and <br />enumeration? <br />40. Can a Structure contain a Pointer to itself? <br />41. How can we check whether the contents of two structure <br />variables are same or not? <br />42. How are Structure passing and returning implemented by the <br />complier? <br />43. How can we read/write Structures from/to data files? <br />44. What is the difference between an enumeration and a set of <br />pre-processor # defines? <br />45. what do the 'c' and 'v' in argc and argv stand for? <br />46. Are the variables argc and argv are local to main? <br />47. What is the maximum combined length of command line arguments <br />including the space between adjacent arguments? <br />48. If we want that any wildcard characters in the command line <br />arguments should be appropriately expanded, are we required to make <br />any special provision? If yes, which? <br />49. Does there exist any way to make the command line arguments <br />available to other functions without passing them as arguments to the <br />function? <br />50. What are bit fields? What is the use of bit fields in a <br />Structure declaration? <br />51. To which numbering system can the binary number <br />1101100100111100 be easily converted to? <br />52. Which bit wise operator is suitable for checking whether a <br />particular bit is on or off? <br />53. Which bit wise operator is suitable for turning off a <br />particular bit in a number? <br />54. Which bit wise operator is suitable for putting on a <br />particular bit in a number? <br />55. Which bit wise operator is suitable for checking whether a <br />particular bit is on or off? <br />56. which one is equivalent to multiplying by 2:Left shifting a <br />number by 1 or Left shifting an unsigned int or char by 1? <br />57. Write a program to compare two strings without using the <br />strcmp() function. <br />58. Write a program to concatenate two strings. <br />59. Write a program to interchange 2 variables without using the <br />third one. <br />60. Write programs for String Reversal & Palindrome check <br />61. Write a program to find the Factorial of a number <br />62. Write a program to generate the Fibinocci Series <br />63. Write a program which employs Recursion <br />64. Write a program which uses Command Line Arguments <br />65. Write a program which uses functions like strcmp(), strcpy()? <br />etc <br />66. What are the advantages of using typedef in a program? <br />67. How would you dynamically allocate a one-dimensional and two-<br />dimensional array of integers? <br />68. How can you increase the size of a dynamically allocated <br />array? <br />69. How can you increase the size of a statically allocated <br />array? <br />70. When reallocating memory if any other pointers point into the <br />same piece of memory do you have to readjust these other pointers or <br />do they get readjusted automatically? <br />71. Which function should be used to free the memory allocated by <br />calloc()? <br />72. How much maximum can you allocate in a single call to malloc<br />()? <br />73. Can you dynamically allocate arrays in expanded memory? <br />74. What is object file? How can you access object file? <br />75. Which header file should you include if you are to develop a <br />function which can accept variable number of arguments? <br />76. Can you write a function similar to printf()? <br />77. How can a called function determine the number of arguments <br />that have been passed to it? <br />78. Can there be at least some solution to determine the number <br />of arguments passed to a variable argument list function? <br />79. How do you declare the following: <br />o An array of three pointers to chars <br />o An array of three char pointers <br />o A pointer to array of three chars <br />o A pointer to function which receives an int pointer and <br />returns a float pointer <br />o A pointer to a function which receives nothing and returns <br />nothing <br />80. What do the functions atoi(), itoa() and gcvt() do? <br />81. Does there exist any other function which can be used to <br />convert an integer or a float to a string? <br />82. How would you use qsort() function to sort an array of <br />structures? <br />83. How would you use qsort() function to sort the name stored in <br />an array of pointers to string? <br />84. How would you use bsearch() function to search a name stored <br />in array of pointers to string? <br />85. How would you use the functions sin(), pow(), sqrt()? <br />86. How would you use the functions memcpy(), memset(), memmove<br />()? <br />87. How would you use the functions fseek(), freed(), fwrite() <br />and ftell()? <br />88. How would you obtain the current time and difference between <br />two times? <br />89. How would you use the functions randomize() and random()? <br />90. How would you implement a substr() function that extracts a <br />sub string from a given string? <br />91. What is the difference between the functions rand(), random<br />(), srand() and randomize()? <br />92. What is the difference between the functions memmove() and <br />memcpy()? <br />93. How do you print a string on the printer? <br />94. Can you use the function fprintf() to display the output on <br />the screen?EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-2078738270879791242007-04-08T13:40:00.000-07:002007-04-08T13:41:34.697-07:00C Project : Quiz Maker/****************************************************************************<br /> * Quiz Maker : This C Project contain code for making Quiz, it will help *<br /> * u in making quiz as per ur requirement. Here Sample Quiz of*<br /> * Hex_to_Bin conversion is taken u can change as per ur *<br /> * requirement. *<br /> * ------------------------------------------------------------------------ *<br /> * Author : Vivek Patel *<br /> * Ahmedabad.INDIA *<br /> * email : vivek_patel9@rediffmail.com *<br /> * Website: http://www.vivekpatel.cjb.net *<br /> * ------------------------------------------------------------------------ *<br /> ****************************************************************************/<br /><br /><br />//Quiz Maker<br /><br />//Tested by hex2bin quiz making<br />//Change Quiz as per ur question and answers...<br />//Feel Free to ask ur queries : vivek_patel9@rediffmail.com<br /><br />//You are requested not to change code except the comment indicating<br />//u to change it...otherwise it will not suit ur requirement..<br /><br /><br />#include <stdio.h><br />#include <conio.h><br />//#include <graphics.h><br /><br />//int gdriver=DETECT, gmode;<br /><br />void scorecard(int);//pass quizno.<br />void quizbox(int,int,int,int,int);<br />//void statusmsg(int);<br /><br />void main(){<br /> int i;<br /> char ch;<br /> for(i=0;i<15;i++){<br /> if(ch==27)<br /> exit(1);<br /> clrscr();<br /> textcolor(LIGHTGREEN);<br /> quizbox(28,1,50,3,2);<br /> gotoxy(30,2);<br /> textcolor(YELLOW);<br /> cprintf("***** QUIZ %d *****",i+1); //Quiz No. currently executed<br /> gotoxy(25,15);<br /> cprintf("Programmed by : Vivek Patel");<br /> gotoxy(25,18);<br /> cprintf("Email: vivek_patel9@rediffmail.com");<br /> gotoxy(25,19);<br /> cprintf("Website: www.vivekpatel.cjb.net");<br /> textcolor(DARKGRAY);<br /> quizbox(23,5,57,11,2);<br /> textcolor(LIGHTMAGENTA);<br /> switch(i){<br /> //Here formating code is redundant u can make a function and call it <br /> //each time...<br /> case 0 : gotoxy(29,6);<br /> //Question 1<br /> //Enter ur Question instead of "Find Hexadecimal to Binary?"<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","9.1A");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i); //For Testing Current Score<br /> //This Comments will be followed to Rest of Questions...<br /> //You can also increase or decrease questions...in quiz<br /> break;<br /> case 1 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","BA4");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 2 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","C8");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 3 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","15");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 4 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","D89F");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 5 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","64AC");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 6 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","9A6");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 7 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","CDAC");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 8 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","DEAF");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 9 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","CAFE");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 10 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","FADE");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 11: gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","FEE");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 12 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","5C");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 13 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","FACE");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> case 14 : gotoxy(29,6);<br /> cprintf("Find Hexadecimal to Binary?");<br /> gotoxy(29,7);<br /> cprintf("For below Given Number!");<br /> gotoxy(35,8);<br /> cprintf(" %-8s","AEC");<br /> gotoxy(30,9);<br /> cprintf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> scorecard(i);<br /> break;<br /> }<br /> textcolor(LIGHTGRAY);<br /> gotoxy(55,2);<br /> cprintf("Escape to Return");<br /> gotoxy(55,3);<br /> cprintf("Any key to continue...");<br /> flushall();<br /> ch=getch();<br /> }<br />}<br /><br /><br />void scorecard(int quizno){<br /> static int right=0,wrong=0,totattempt=0,currentscore=0;<br /> char userans[25];<br /><br /> //Enter answers of quiz respectively for all questions<br /> //In the below given...array<br /> //ans1 ans2 ans3 ans4 ans5 and so on....<br /> char quizans[15][25]={"1001.00011010","101110100100","11001000","10101","1101100010011111","110010010101100","100110100110","1100110110101100","1101111010101111","1100101011111110","1111101011011110","111111101110","1011100","1111101011001110","101011101100"};<br /> gotoxy(34,10);<br /> scanf("%s",&userans);<br /> strupr(userans);<br /> textcolor(DARKGRAY);<br /> quizbox(22,12,58,15,2);<br /> textcolor(LIGHTMAGENTA);<br /> if(strcmp(quizans[quizno],userans)==0){<br /> right++;<br /> textcolor(LIGHTGREEN + BLINK);<br /> gotoxy(35,13);<br /> cprintf("RIGHT!!!");<br /> }<br /> else{<br /> wrong++;<br /> textcolor(LIGHTRED + BLINK);<br /> gotoxy(35,13);<br /> cprintf("WRONG");<br /> textcolor(LIGHTGREEN);<br /> gotoxy(24,14);<br /> cprintf("Correct Answer is %s",quizans[quizno]);<br /> }<br /> totattempt++;<br /> currentscore=(int)((right * 100)/totattempt);<br /><br /> textcolor(LIGHTGRAY);<br /> quizbox(22,16,58,18,2);//for score board<br /> quizbox(22,19,58,25,2);//for it's details<br /><br /> textcolor(LIGHTCYAN);<br /> gotoxy(35,17);<br /> cprintf("SCORE BOARD");<br /> textcolor(WHITE);<br /> gotoxy(25,20);<br /> cprintf("Total Right : %d",right);<br /> gotoxy(25,21);<br /> cprintf("Total Wrong : %d",wrong);<br /> gotoxy(25,22);<br /> cprintf("Total Attempt : %d out of 15",totattempt);<br /> gotoxy(23,23);<br /> printf("ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ");<br /> gotoxy(25,24);<br /> textcolor(YELLOW);<br /> cprintf("Current Score : %d",currentscore);<br /> /* if(quizno==14){<br /> getch();<br /> statusmsg(currentscore);<br /> exit(1);<br /> }<br /> */<br />}<br /><br /><br /><br /><br /><br />void quizbox(int x1, int y1, int x2, int y2,int linestyle)<br />{<br /> int col,row;<br /> if(linestyle==1){<br /> for (col = x1; col < x2; col++)<br /> {<br /> gotoxy(col, y1);<br /> cprintf("%c", 196);<br /> gotoxy(col, y2);<br /> cprintf("%c", 196);<br /> }<br /><br /> for (row = y1; row < y2; row++)<br /> {<br /> gotoxy(x1, row);<br /> cprintf("%c", 179);<br /> gotoxy(x2, row);<br /> cprintf("%c", 179);<br /> }<br /><br /> gotoxy(x1, y1);<br /> cprintf("%c", 218);<br /> gotoxy(x1, y2);<br /> cprintf("%c", 192);<br /> gotoxy(x2, y1);<br /> cprintf("%c", 191);<br /> gotoxy(x2, y2);<br /> cprintf("%c", 217);<br /> }<br /> else{<br /> for (col = x1; col < x2; col++)<br /> {<br /> gotoxy(col, y1);<br /> cprintf("%c", 205);<br /> gotoxy(col, y2);<br /> cprintf("%c", 205);<br /> }<br /><br /> for (row = y1; row < y2; row++)<br /> {<br /> gotoxy(x1, row);<br /> cprintf("%c", 186);<br /> gotoxy(x2, row);<br /> cprintf("%c", 186);<br /> }<br /><br /> gotoxy(x1, y1);<br /> cprintf("%c", 201);<br /> gotoxy(x1, y2);<br /> cprintf("%c", 200);<br /> gotoxy(x2, y1);<br /> cprintf("%c", 187);<br /> gotoxy(x2, y2);<br /> cprintf("%c", 188);<br /> }<br />}<br /><br /><br /><br />//Lastly Giving Greet According to Quiz Status<br />// Use the section only if u have knowledge of Graphics<br />/*<br />void statusmsg(int score){<br /> initgraph(&gdriver, &gmode,"c:\\tc\\bgi");<br /> setcolor(LIGHTMAGENTA);<br /> settextstyle(SANS_SERIF_FONT,HORIZ_DIR,1);<br /> outtextxy(5,415,"Programmer : VIVEK PATEL");<br /> outtextxy(5,435,"E-Correspondence : vivek_patel9@rediffmail.com");<br /> outtextxy(5,455,"WebSite : www.vivekpatel.cjb.net");<br /><br /> setcolor(YELLOW);<br /> settextstyle(SANS_SERIF_FONT,HORIZ_DIR,8);<br /> if(score==100)<br /> outtextxy(50,50,"KEEP IT UP!");<br /> else if(score>=85)<br /> outtextxy(50,50,"Well Done!");<br /> else if(score>=75)<br /> outtextxy(100,50,"Good");<br /> else if(score>=70)<br /> outtextxy(20,50,"Practise Require!");<br /> else if(score>=60)<br /> outtextxy(20,50,"Revision Needed!");<br /> else if(score>=50)<br /> outtextxy(50,50,"Work Hard!");<br /> else<br /> outtextxy(50,50,"Read Tutorial!");<br /><br /> getch();<br /> closegraph();<br />}<br />*/EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-3872542648329706702007-04-08T13:38:00.000-07:002007-04-08T13:40:07.557-07:00Write a C Program to display Progressbar (Graphics)/****************************************************************************<br /> * ProgressBar : This programm contains code for progressbar it work *<br /> * same as progressbar displayed in window's environment. *<br /> * (Progressbar for Graphics program) *<br /> * ------------------------------------------------------------------------ *<br /> * Author : Vivek Patel *<br /> * Ahmedabad.INDIA *<br /> * email : vivek_patel9@rediffmail.com *<br /> * WWW : http://www.geocities.com/vivek_patel9/index.html *<br /> * ------------------------------------------------------------------------ *<br /> ****************************************************************************/<br /><br /><br /><br />#include <graphics.h><br />#include <stdio.h><br />#include <dos.h><br />#include <conio.h><br /><br />#define CNT_ROW 5 //Counter in ProgressBar's --> Col position<br />#define CNT_COL 40 //Counter in ProgressBar's --> Row position<br /><br />#define PROGRESS_X1 200//ProgressBar's --> Starting position<br />#define PROGRESS_X2 460//ProgressBar's --> Ending position<br /><br />#define PROGRESS_Y1 55 //ProgressBar's --> Starting Height<br />#define PROGRESS_Y2 85 //ProgressBar's --> Ending Height<br /><br />#define delayTime 50 //Speed of ProgressBar<br /><br />int main(void)<br />{<br /> /* request auto detection */<br /> int gdriver = DETECT, gmode, errorcode;<br /> int i,j,cnt=0,clrflag=0;<br /><br /> /* initialize graphics and local variables */<br /> initgraph(&gdriver, &gmode, "c:\\tc\\bgi");<br /><br /> /*-------Introduction Line----------*/<br /> setcolor(LIGHTGREEN);<br /> settextstyle(TRIPLEX_FONT,HORIZ_DIR,5);<br /> outtextxy(5,100,"Graphical ProgressBar");<br /> setcolor(LIGHTCYAN);<br /> settextstyle(SMALL_FONT,HORIZ_DIR,6);<br /> outtextxy(5,180,"Programmed By : Vivek Patel");<br /> outtextxy(5,200,"Email : vivek_patel9@rediffmail.com");<br /> outtextxy(5,220,"Website : www.vivekpatel.cjb.net");<br /> /*-------Introduction Line----------*/<br /><br /> setcolor(CYAN);<br /> j=PROGRESS_X1;<br /> cnt=5;<br /> for(i=j;i<PROGRESS_X2;i++){<br /> delay(delayTime);<br /> gotoxy(CNT_COL,CNT_ROW);<br /> printf("%d",cnt);<br /> rectangle(j,PROGRESS_Y1,i,PROGRESS_Y2);<br /> if(i==(j+10)){<br /> j=j+13;<br /> i=j;<br /> if(clrflag==1){<br /> clrflag=0;<br /> setcolor(CYAN);<br /> }<br /> else{<br /> clrflag=1;<br /> setcolor(BLUE);<br /> }<br /> cnt=cnt+5;<br /> }<br /> }<br /><br /> setcolor(WHITE);<br /> outtextxy(5,260,"Press Any Key to Return...");<br /><br /><br /><br /><br /> /* clean up */<br /> getch();<br />// closegraph();<br /> return 0;<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-17504561174640558402007-04-08T13:37:00.000-07:002007-04-08T13:38:41.091-07:00Write a C Program to display Progressbar/****************************************************************************<br /> * ProgressBar : This programm contains code for progressbar it work *<br /> * same as progressbar displayed in window's environment. *<br /> * (Progressbar for Non-Graphics program) *<br /> * ------------------------------------------------------------------------ *<br /> * Author : Vivek Patel *<br /> * Ahmedabad.INDIA *<br /> * email : vivek_patel9@rediffmail.com *<br /> * WWW : www.vivekpatel.cjb.net *<br /> ****************************************************************************/<br /><br /><br /><br />#include <stdio.h><br />#include <conio.h><br />#include <dos.h><br /><br />/*<br />start_x : x-axis starting (progressbar starting[x-cordinate])<br />end_x : x-axis ending (progressbar ending[x-cordinate])<br />y : Row no. where progressbar should be placed<br />symbol : Symbol to be displayed<br />style : 0 for smooth progressbar<br /> 1 for rough progressbar<br />dlytime : delay time (in milliseconds)<br /><br />fillclr : fill color for progressbar<br />fillbkclr : fill backcolor for progressbar<br /><br />color may be from following option...<br />Constant ³Value<br />ÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍ<br /> BLACK ³ 0<br /> BLUE ³ 1<br /> GREEN ³ 2<br /> CYAN ³ 3<br /> RED ³ 4<br /> MAGENTA ³ 5<br /> BROWN ³ 6<br /> LIGHTGRAY ³ 7<br /> DARKGRAY ³ 8<br /> LIGHTBLUE ³ 9<br /> LIGHTGREEN ³ 10<br /> LIGHTCYAN ³ 11<br /> LIGHTRED ³ 12<br /> LIGHTMAGENTA ³ 13<br /> YELLOW ³ 14<br /> WHITE ³ 15<br /><br />*/<br />void progressbar(int start_x,int end_x,int y,char symbol,int style,int dlytime,int fillclr,int fillbkclr)<br />{<br /> int i,len,temp,dly;<br /> len=end_x-start_x;<br /> dly=dlytime/len;<br /><br /> _setcursortype(_NOCURSOR);<br /><br /> textbackground(fillbkclr);<br /> temp=start_x;<br /> for (i=1;i<=len+1;++i,++start_x)<br /> {<br /> gotoxy(start_x,y);<br /> cprintf("%c",symbol);<br /> }<br /> start_x=temp;<br /> gotoxy(start_x,y);<br /><br /><br /> textbackground(fillclr);<br /> temp=start_x;<br /> for (i=1;i<=len+1;++i,++start_x)<br /> {<br /> if(style==1){<br /> if(i%2!=0){<br /> gotoxy(start_x,y);<br /> delay(dly);<br /> cprintf("%c",symbol);<br /> }<br /> }<br /> else{<br /> gotoxy(start_x,y);<br /> delay(dly);<br /> cprintf("%c",symbol);<br /> }<br /> }<br /><br /> gotoxy(temp,y+1);<br /> _setcursortype(_NORMALCURSOR);<br /><br />}<br /><br />void main(){<br />clrscr();<br />/*examples*/<br />progressbar(20,50,12,' ',0,2000,BLUE,LIGHTGRAY);<br />progressbar(10,70,14,' ',0,500,RED,YELLOW);<br />progressbar(30,40,16,' ',0,15000,MAGENTA,LIGHTGREEN);<br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-55155070290492951182007-04-08T13:08:00.001-07:002007-04-08T13:08:51.380-07:00Write a C Program to Run .Exe File/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <process.h><br />#include <stdio.h><br />#include <errno.h><br /><br />void main(int argc,char *argv[])<br />{<br /> //int i;<br /><br /> spawnv(P_WAIT,"ims.EXE", argv);<br /><br /> perror("exec error");<br /> exit(1);<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-34892246848856200242007-04-08T13:07:00.001-07:002007-04-08T13:07:59.946-07:00Write a C Program demonstrating xstrstr() function/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br /><br />void main(){<br /> char * xstrstr(char *,char *);<br /> char *string;<br /> char *ptr,c[15];<br /> clrscr();<br /> printf("Enter a string : ");<br /> gets(string);<br /> printf("Enter search string : ");<br /> gets(c);<br /> ptr = xstrstr(string, c);<br /> printf("\nOutput of function is : %s\n",ptr);<br /> getch();<br />}<br /><br />char * xstrstr(char *str,char *ch){<br /> int i,j,len,k;<br /> char *temp;<br /> for(len=0;ch[len];len++); // for lenngth<br /> for(i=0;str[i];i++){<br /> for(j=0;j<len;j++)<br /> temp[j]=str[i+j];<br /> temp[j]='\0';<br /> if(strcmp(temp,ch)==0){<br /> for(k=j;str[i+k];k++)<br /> temp[k]=str[i+k];<br /> temp[k]='\0';<br /> return(temp);<br /> }<br /> }<br /> return(0);<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-59617470043695393402007-04-08T13:06:00.001-07:002007-04-08T13:06:41.457-07:00Write a C Program demonstrating xstrchr() function/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br /><br />void main(){<br /> char * xstrchr(char *,char);<br /> char string[15];<br /> char *ptr,c;<br /> clrscr();<br /> printf("Enter a string : ");<br /> scanf("%[^\n]s",string);<br /> printf("Enter search character : ");<br /> flushall();<br /> scanf("%c",&c);<br /> ptr = xstrchr(string, c);<br /> printf("\nOutput of function is : %s\n",ptr);<br /> if (ptr)<br /> printf("The character %c is at position: %d\n", c, ptr-string);<br /> else<br /> printf("The character was not found\n");<br /> getch();<br />}<br /><br />char * xstrchr(char *str,char ch){<br /> int i;<br /> for(i=0;str[i];i++){<br /> if(str[i]==ch)<br /> return ((str+i)+1);<br /> }<br /> return(0);<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-74281974663641379682007-04-08T13:05:00.001-07:002007-04-08T13:05:45.963-07:00Write a C Program to Find Total No. of Vowels in a given string/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int chasc,i,cnt=0;<br /> char ch,str[40]="";<br /> clrscr();<br /> printf("*****Vowels Demo*****\n\n");<br /> printf("enter string : ");<br /> scanf("%[^\n]s",str);<br /> for(i=0;str[i]!='\0';i++)<br /> {<br /> chasc = str[i];<br /> switch(chasc){<br /> case 'a' :<br /> case 'A' :<br /> case 'e' :<br /> case 'E' :<br /> case 'i' :<br /> case 'I' :<br /> case 'o' :<br /> case 'O' :<br /> case 'u' :<br /> case 'U' :<br /> cnt++;<br /> }<br /> }<br /><br /> printf("\nTotal number of vowels is %d",cnt);<br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-41308043699477144652007-04-08T13:04:00.001-07:002007-04-08T13:04:47.126-07:00Write a C Program to display triangle/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int i,j,k,n;<br /> clrscr();<br /> printf("Enter num : ");<br /> scanf("%d",&n);<br /> for(i=n;i>0;i--){<br /> for(k=i;k>0;k--)<br /> printf(" ");<br /> for(j=0;j<(n-(i-1));j++)<br /> printf("%3c",'*');<br /> printf("\n");<br /> }<br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-68062685763882480732007-04-08T13:03:00.000-07:002007-04-08T13:04:06.624-07:00Write a prog to swap even positioned chars with odd positioned chars in a given string./**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br />void main(){<br /> char str[20],tmp;<br /> int i,j;<br /> clrscr();<br /> printf("\nEnter a string : ");<br /> scanf("%s",str);<br /> printf("\n\nOriginal String : %s",str);<br /> for(i=0;i<strlen(str);i=i+2){<br /> tmp = str[i];<br /> str[i] = str[i+1];<br /> str[i+1] = tmp;<br /> }<br /> printf("\nAfter Swap String : %s",str);<br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-49064482459098408992007-04-08T13:02:00.001-07:002007-04-08T13:02:55.834-07:00Write a C Program for extracting sub-string from string/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int m,n,i,len;<br /> char str[40]="",substr[40]="";<br /> clrscr();<br /> printf("*****SubString Demo*****\n\n");<br /> printf("Enter string : ");<br /> scanf("%[^\n]s",str);<br /> for(m=0;str[m]!='\0';m++);<br /><br /> len = m;<br /><br /> printf("\nString Extracting Details\n");<br /> strt:<br /> printf("enter starting position : ");<br /> scanf("%d",&m);<br /> printf("enter ending position : ");<br /> scanf("%d",&n);<br /><br /> if(m<=0 || m>len || n<m || n<=0 || n>len){<br /> printf("\n\nInvalid Input\n\n");<br /> goto strt;<br /> }<br /> else{<br /> for(i=0;m<=n;m++,i++)<br /> substr[i]=str[m-1];<br /> substr[i]='\0';<br /> printf("\nSub String is %s",substr);<br /> }<br /><br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-5938767040738566012007-04-08T13:00:00.000-07:002007-04-08T13:01:48.164-07:00Write a C Program for String Output/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br />void main(){<br /> int len;<br /> char s[]="VIVEK PATEL";<br /> clrscr();<br /> len = strlen(s);<br /> while(len>0){<br /> printf("\n%-15.*s",len,s);<br /> len--;<br /> }<br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-19148395218810140642007-04-08T12:59:00.001-07:002007-04-08T12:59:59.028-07:00Write a C Program for String Copy/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br />void main(){<br /> char str1[20],str2[20],ch;<br /> int i;<br /> clrscr();<br /> printf("*****Strings Copy Function*****\n\n");<br /> printf("Enter string1: ");<br /> scanf("%s",str1);<br /> printf("\n\nUsing Inbuilt Function");<br /> strcpy(str2,str1);<br /> printf("\nString1 : %s\nString2 : %s\n",str1,str2);<br /><br /> strcpy(str2,""); //empty to copy again<br /> printf("\n\nWithout Using Inbuilt Function");<br /> for(i=0;str1[i]!='\0';i++)<br /> str2[i] = str1[i];<br /> str2[i]='\0';<br /> printf("\nString1 : %s\nString2 : %s\n",str1,str2);<br /><br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-30918242311220780372007-04-08T12:55:00.000-07:002007-04-08T12:56:14.172-07:00Write a C Program to Concat string/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br /><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br />void main(){<br /> char str1[20],str2[20],str3[40]="";<br /> int len,i,j;<br /> clrscr();<br /> printf("*****Strings Concatination Function*****\n\n");<br /> printf("Enter string1: ");<br /> scanf("%s",str1);<br /> printf("Enter string2: ");<br /> scanf("%s",str2);<br /><br /> for(i=0,j=0;str1[i]!='\0';i++,j++)<br /> str3[j] = str1[i];<br /><br /> for(i=0;str2[i]!='\0';i++,j++)<br /> str3[j] = str2[i];<br /><br /> str3[j] = '\0';<br /> len = j;<br /><br /> printf("\n\nAfter Concatination : %s",str3);<br /> printf("\n\nLength of concated string is %d",len);<br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-5944128615233354082007-04-08T12:54:00.000-07:002007-04-08T12:55:08.897-07:00C Project : Write a C Program for Telepone directory/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />#include <string.h><br /><br />struct person{<br /> char name[20];<br /> long telno;<br />};<br /><br />void appendData(){<br /> FILE *fp;<br /> struct person obj;<br /> clrscr();<br /> fp=fopen("data.txt","a");<br /> printf("*****Add Record****\n");<br /> printf("Enter Name : ");<br /> scanf("%s",obj.name);<br /> printf("Enter Telephone No. : ");<br /> scanf("%ld",&obj.telno);<br /> fprintf(fp,"%20s %7ld",obj.name,obj.telno);<br /> fclose(fp);<br />}<br /><br />void showAllData(){<br /> FILE *fp;<br /> struct person obj;<br /> clrscr();<br /> fp=fopen("data.txt","r");<br /> printf("*****Display All Records*****\n");<br /> printf("\n\n\t\tName\t\t\tTelephone No.");<br /> printf("\n\t\t=====\t\t\t===============\n\n");<br /> while(!feof(fp))<br /> {<br /> fscanf(fp,"%20s %7ld",obj.name,&obj.telno);<br /> printf("%20s %30ld\n",obj.name,obj.telno);<br /> }<br /> fclose(fp);<br /> getch();<br />}<br /><br />void findData(){<br /> FILE *fp;<br /> struct person obj;<br /> char name[20];<br /> int totrec=0;<br /> clrscr();<br /> fp=fopen("data.txt","r");<br /> printf("*****Display Specific Records*****\n");<br /> printf("\nEnter Name : ");<br /> scanf("%s",&name);<br /> while(!feof(fp))<br /> {<br /> fscanf(fp,"%20s %7ld",obj.name,&obj.telno);<br /> if(strcmpi(obj.name,name)==0){<br /> printf("\n\nName : %s",obj.name);<br /> printf("\nTelephone No : %ld",obj.telno);<br /> totrec++;<br /> }<br /> }<br /> if(totrec==0)<br /> printf("\n\n\nNo Data Found");<br /> else<br /> printf("\n\n===Total %d Record found===",totrec);<br /> fclose(fp);<br /> getch();<br />}<br /><br /><br /><br />void main(){<br /> char choice;<br /> while(1){<br /> clrscr();<br /> printf("*****TELEPHONE DIRECTORY*****\n\n");<br /> printf("1) Append Record\n");<br /> printf("2) Find Record\n");<br /> printf("3) Read all record\n");<br /> printf("4) exit\n");<br /> printf("Enter your choice : ");<br /> fflush(stdin);<br /> choice = getche();<br /> switch(choice){<br /> case '1' : //call append record<br /> appendData();<br /> break;<br /> case '2' : //call find record<br /> findData();<br /> break;<br /> case '3' : //Read all record<br /> showAllData();<br /> break;<br /> case '4' :<br /> case 27 : exit(1);<br /> }<br /> }<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-41110529535931418182007-04-08T12:52:00.000-07:002007-04-08T12:53:49.747-07:00Write a C Program to Sort given data/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br /><br />void main(){<br /> int *arr,i,j,tmp,n;<br /> printf("Enter how many data you want to sort : ");<br /> scanf("%d",&n);<br /> for(i=0;i<n;i++)<br /> scanf("%d",arr+i);<br /><br /> for(i=0;i<n;i++)<br /> {<br /> for(j=i+1;j<n;j++){<br /> if( *(arr+i) > *(arr+j)){<br /> tmp = *(arr+i);<br /> *(arr+i) = *(arr+j);<br /> *(arr+j) = tmp;<br /> }<br /> }<br /> }<br /><br /> printf("\n\nAfter Sort\n");<br /> for(i=0;i<n;i++)<br /> printf("%d\n",*(arr+i));<br /><br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-58774258874967399582007-04-08T12:51:00.000-07:002007-04-08T12:52:30.390-07:00Write a C Program to demonstrating graphics - screen saver/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <stdlib.h><br />#include <graphics.h><br />#include <conio.h><br /><br />void main(){<br />int gdriver=DETECT,gmode;<br />int left=200,top=200,right=700,bottom=700,color=15,pat=8;<br />initgraph(&gdriver,&gmode,"");<br />cleardevice();<br />while(!kbhit()){<br /> setfillstyle(random(pat),random(color));<br /> bar(random(left),random(top),random(right),random(bottom));<br /> delay(250);<br />}<br />closegraph();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-82707958980777644032007-04-08T12:50:00.002-07:002007-04-08T12:51:41.164-07:00Write a C Program to demonstrating graphics/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <stdlib.h><br />#include <graphics.h><br />#include <conio.h><br /><br />void main(){<br />int gdriver=DETECT,gmode,col=400,row=600,font=4,direction=2,size=8,color=15;<br />initgraph(&gdriver,&gmode,"");<br />cleardevice();<br />while(!kbhit()){<br /> settextstyle(random(font),random(direction),random(size));<br /> setcolor(random(color));<br /> outtextxy(random(col),random(row),"Vivek Patel");<br /> delay(250);<br />}<br />closegraph();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-58757737443769784672007-04-08T12:50:00.001-07:002007-04-08T12:50:40.522-07:00Write a C Program demonstrating Multi dimensional array/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int salitm[4][3],i,j,itmtot[3]={0},salpertot[4]={0};<br /> clrscr();<br /> printf("*****Sales Item Demo*****\n\n");<br /> printf("Enter details for 4 salesman and 3 items\n");<br /> //logic<br /> for(i=0;i<4;i++){<br /> for(j=0;j<3;j++){<br /> scanf("%d",&salitm[i][j]);<br /> salpertot[i] = salpertot[i] + salitm[i][j];<br /> itmtot[j] = itmtot[j] + salitm[i][j];<br /> }<br /> }<br /><br /> //display<br /> printf("\n\n\tItem1\tItem2\tItem3\n");<br /> for(i=0;i<4;i++){<br /> printf("%s%-4d","S",i+1);<br /> for(j=0;j<3;j++){<br /> printf("%*d",7+j,salitm[i][j]);<br /> }<br /> printf("\n");<br /> }<br /><br /> printf("\nItem Wise total\n");<br /> for(j=0;j<3;j++)<br /> printf("%s%-3d=%5d\t","Item",j+1,itmtot[j]);<br /><br /> printf("\n\nSalesman Wise total\n");<br /> for(j=0;j<4;j++)<br /> printf("%s%-3d=%5d\t","S",j+1,salpertot[j]);<br /><br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-28302778301295476762007-04-08T12:49:00.001-07:002007-04-08T12:49:40.967-07:00Write a prog. that will rotate string, typed in to it./*Write a prog. that will rotate string, typed in to it.<br />eg: "space"<br />paces acesp cespa espac<br />*/<br /><br /><br />/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <string.h><br />#include <conio.h><br />void main(){<br /> char name[20];<br /> int i,j,k;<br /> clrscr();<br /> printf("\nEnter a string : ");<br /> scanf("%s",name);<br /> for(i=0;i<strlen(name);i++){<br /> printf("\n");<br /> for(j=i+1;j<strlen(name);j++)<br /> printf("%c",name[j]);<br /> for(k=0;k<=i;k++)<br /> printf("%c",name[k]);<br /> }<br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-64811901149908409622007-04-08T12:48:00.001-07:002007-04-08T12:48:51.128-07:00Wrtie a C Program to Generate Random Number/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <stdlib.h><br />#include <conio.h><br /><br />void main(){<br />int i,cnt=0,rnd;<br />clrscr();<br />while(1){<br /> rnd=random(100);<br /> if(rnd>50 && rnd<100){<br /> printf("\nRandom No [%d] : %d ",cnt+1,rnd);<br /> cnt++;<br /> }<br /> if(cnt==10)<br /> break;<br />}<br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-74926583733880479152007-04-08T12:47:00.000-07:002007-04-08T12:48:05.240-07:00Write a C Program to generate Pyramid/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int i,j,k,m,num,c,tmp;<br /> clrscr();<br /> printf("*****PYRAMID*****\n\n");<br /> printf("Enter num of lines : ");<br /> scanf("%d",&num);<br /> for(i=1;i<=num;i++){<br /> c=i;<br /> for(k=1;k<=(num-i);k++)<br /> putchar(' ');<br /><br /> for(j=i;j>=1;j--){<br /> if(c>9){<br /> printf("%d",0);<br /> tmp=c;<br /> }<br /> else{<br /> printf("%d",c++);<br /> tmp=c;<br /> }<br /> }<br /> tmp--;<br /><br /> for(m=tmp;m>i;)<br /> printf("%d",--m);<br /><br /> printf("\n");<br /> }<br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-17643334726457066162007-04-08T12:46:00.000-07:002007-04-08T12:47:11.083-07:00Write a program to find first N prime numbers./**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int n,i,c=0,j,flag;<br /> clrscr();<br /> printf("*****Finding First N PRIME NUMBERS*****\n\n");<br /> printf("Enter number : ");<br /> scanf("%d",&n);<br /><br /> for(i=2;c<n;i++){<br /> for(j=2;j<i;j++){<br /> if(i%j == 0)<br /> goto out;<br /> }<br /> printf("\n%3d is a PRIME NUMBER",i);<br /> c++;<br /> out:<br /> }<br /><br />getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.comtag:blogger.com,1999:blog-8722837098351365150.post-29171990875237782002007-04-08T12:37:00.000-07:002007-04-08T12:38:03.295-07:00Program to Find Whether Number entered is PRIME or NOT.//Program to Find Whether Number entered is PRIME or NOT.<br /><br /><br />/**************************************************************/<br />/*Programmed by : Vivek Patel**********************************/<br />/*For Bugs Free feel to contact********************************/<br />/*Website : www.vivekpatel.cjb.net*****************************/<br />/*Email : vivek_patel9@rediffmail.com**************************/<br />/**************************************************************/<br /><br />#include <stdio.h><br />#include <conio.h><br />void main(){<br /> int num,i;<br /> clrscr();<br /> printf("*****PRIME NUMBER*****\n\n");<br /> printf("Enter the number to find it is prime or not : ");<br /> scanf("%d",&num);<br /> for(i=2;i<num;i++){<br /> if(num%i==0){<br /> printf("\n\n%d is Not a Prime Number\n",num);<br /> printf("It is divisible by %d, ...",i);<br /> goto out;<br /> }<br /> }<br /> printf("\n\n%d is a PRIME number",num);<br /> out:<br /> getch();<br />}EasyTutor.2ya.comhttp://www.blogger.com/profile/04883644537318199367noreply@blogger.com