tag:blogger.com,1999:blog-88481067510376118352024-03-08T04:23:12.622-08:00projectxplodadminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.comBlogger99125tag:blogger.com,1999:blog-8848106751037611835.post-34688096373682374442012-09-14T00:34:00.000-07:002012-09-14T00:34:17.025-07:00C++ Program to define a function and incorporate the array of structures to input and store any 30 records<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to define a function and incorporate the array of structures to input and store any 30 records</span></blockquote>
<span style="font-size: large;"></span><br />
<blockquote class="tr_bq">
<span style="font-size: large;">Display the following using functions incorporated through structure definition viz. display of all entered records,sort the records according to the marks in descending order and display of sorted records.</span></blockquote>
<pre class="brush: plain">
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
struct ward
{
char name[20];
float marks;
} stud[5];
void display();
void sort();
void dispsort();
main()
{
clrscr();
// Data entry
clrscr();
cout<<"D A T A : ENTRY PROCESS: Enter 5 Records Initially"<<endl;
for(int i=0;i<5;i++)
{
cout<<"\nEnter name";
cin>>stud[i].name;
cout<<"\nEnter marks";
cin>>stud[i].marks;
}
clrscr();
display(); // Call of Function
// to display data entered.
cout<<"Press any key to continue";
getch();
clrscr();
sort(); // Call of Function
// to sort data
clrscr();
cout<<"Press any key to display ";
cout<<"the sorted data";
getch();
dispsort(); // Call of Function
// to display the sorted data.
cout<<endl;
cout<<"Press any key to continue";
getch();
return 0;
}
void display() // Definition of the function
// to display the data values.
{
clrscr();
cout<<"DATA LIST AS ENTERED";
cout<<endl;
for(int k=0;k<5;k++)
{
cout<<"NAME OF THE STUDENT IS ";
cout<<stud[k].name;
cout<<endl;
cout<<"HIS MARKS IS ";
cout<<stud[k].marks;
cout<<endl;
cout<<"***************************************";
cout<<endl;
cout<<"***************************************";
cout<<endl;
}
}
void sort() // Definition of the sort function.
{
// sorting done according to marks.
char nam[20];
int mark=0;
for(int r=0;r<4;r++)
{
for(int s=r+1;s<5;s++)
{
if (stud[r].marks < stud[s].marks)
{
strcpy(nam,stud[r].name);
strcpy(stud[r].name,stud[s].name);
strcpy(stud[s].name,nam);
mark=stud[r].marks;
stud[r].marks=stud[s].marks;
stud[s].marks=mark;
}
}
}
}
void dispsort() // Definition of the function
// to print the sorted data.
{
clrscr();
cout<<"Display of sorted data according to marks";
cout<<endl;
display();
cout<<endl;
cout<<"End of data encountered";
cout<<endl;
cout<<"Press any key to continue";
getch();
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-90180710885964482452012-09-14T00:30:00.000-07:002012-09-14T00:30:29.291-07:00C++ Program to sort the given strings in Ascending order<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to sort the given strings in Ascending order</span></blockquote><pre class="brush: plain">
<br />
#include <stdio.h><br />#include <conio.h><br />#include <string.h> <br />void main() <br />{<br />clrscr();<br />char name[10][20],temp[10][20]; <br />int i,j,n; <br />printf ("\nENTER THE NUMBER OF NAMES TO BE ASCENDED : "); <br />scanf ("%d",&n); <br />for (i=0;i<n;i++) <br />{ <br />printf ("ENTER THE %d NAME : ",i+1); <br />scanf ("%s",name[i]); <br />} <br />printf ("\n The ascending order of the names is : \n "); <br />for (i=0;i<n;i++) <br />{ <br />for (j=i+1;j<n;j++) <br />{ <br />if (strcmp(name[i],name[j])>0) <br />{ <br />strcpy (temp[i],name[i]);<br />strcpy (name[i],name[j]);<br />strcpy (name[j],temp[i]);<br />}<br />}<br />printf ("\n%s",name[i]);<br />}<br />getch();<br />} </div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-65643749679491859272012-09-14T00:29:00.001-07:002012-09-14T00:29:03.511-07:00C++ Program to input a string and a character. Print the frequency of the character within the string<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to input a string and a character. Print the frequency of the character within the string</span></blockquote>
<pre class="brush: plain">
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<stdio.h>
main()
{
clrscr();
char name[40],input;
int l=0,count=0;
cout<<"Enter any word "<<endl;
gets(name);
cout<<endl<<"Enter the character to print the frequency";
cin>>input;
l = strlen(name);
cout<<endl;
for (int a=0;a<l;a++)
{
if (name[a]==input) count = count + 1;
}
cout<<endl<<"The frequency of "<<input<<" is "<<count<<endl;
getch();
return 0;
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-21251785135372304042012-09-14T00:27:00.003-07:002012-09-14T00:27:49.347-07:00C++ Program to input any string and print the number of 'the'<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to input any string and print the number of 'the'</span></blockquote><pre class="brush: plain">
<br />
#include<iostream.h><br />#include<conio.h><br />#include<stdio.h><br />#include<string.h><br />main()<br />{<br />clrscr();<br />char name[50];<br />int l=0,c=0;<br />cout<<"Enter any string "<<endl;<br />gets(name);<br />l = strlen(name);<br />cout<<endl;<br />for(int i=0;i<=l;i++)<br />{<br />if ((name[i]=='t') && (name[i+1]=='h') && ((name[i+2])=='e'))<br />c=c+1;}<br />cout<<endl;<br />cout<<"total the is "<<c;<br />getch();<br />return 0;<br /><br />}</div>
</pre>adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-77932842950820004872012-09-14T00:26:00.004-07:002012-09-14T00:26:52.242-07:00C++ Program to input any ten numbers and print them in ascending order<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to input any ten numbers and print them in ascending order</span></blockquote>
<pre class="brush: plain">
#include<iostream.h>
#include<conio.h>
main()
{
int number[10],a,b,c,d;
clrscr(); // clear the screen
cout<<"Enter the elements of the array"<<endl;
for(int i=0;i<10;i++)
{
cout<<"Enter number for cell "<<i<<endl;
cin>>number[i];
}
cout<<endl<<"Thank You ! The data entry is over"<<endl;
cout<<"Press any key to continue";
getch();
clrscr();
// sorting of data
for(int j=0;j<9;j++)
{
for(int k=j+1;k<10;k++)
{
if (number[j]>number[k])
{
a=number[j];
number[j]=number[k];
number[k]=a;
}
}
}
cout<<"The list in ascending order is ";
cout<<endl;
for(i=0;i<10;i++)
cout<<number[i]<<"\t";
cout<<endl<<"Press any key to return to the editor";
getch();
return 0;
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-31307361798842542922012-09-14T00:25:00.002-07:002012-09-14T00:25:34.923-07:00C++ Program using function allows the user to enter a number and than rounds it off,correct to the nearest integer<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program using function allows the user to enter a number and than rounds it off,correct to the nearest integer</span></blockquote><pre class="brush: plain">
<br />
<br />#include <iostream.h><br />#include <conio.h> //HEADER FILES<br /><br /><br />void main() // MAIN FUNCTION<br /><br /> {<br /> clrscr(); // CLEAR THE SCREEN<br /><br /> float input=0,remainder=0; // INITIALIZATION AND DECLARATION OF<br /> int whole=0,answer=0; // VARIABLES<br /><br /> gotoxy (15,15); // GO TO A PARTICULAR POSITION<br /><br /> cout << "ENTER A FLOAT NUMBER : "; // MESSAGE<br /><br /> cin >> input; // STORE THE INPUT INTO THE VARIABLE<br /><br /> whole = input; // THIS LINE STORES THE INTEGER PART OF THE VALUE<br /> // INTO A SEPERATE VARIABLE<br /><br /> remainder = input - whole; // REMAINDER IS THE VALUE AFTER THE DECIMAL<br /> // POINT<br /><br /> if (remainder >= 0.5) // IF REMAINDER IS GREATER THAN 0.5<br /><br /> answer = whole + 1; // ADD 1 TO THE VALUE<br /><br /> else // OTHERWISE<br /><br /> answer = whole; // KEEP THE INTEGER PART AS IT IS<br /><br /> gotoxy (15,16);<br /> cout << "Rounded Off Number Is : " << answer; // DISPLAY THE ANSWER<br /><br /> getch(); // WAIT FOR AN INPUT FROM THE USER.<br /><br /> } // END OF FUNCTION<br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-48185767424818994282012-09-14T00:22:00.002-07:002012-09-14T00:22:45.692-07:00C++ Program to Rotates a word<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to Rotates a word </span><br />
<span style="font-size: large;">This program prints all the rotation of a word. <br />Say if the input word is "space", then it prints <br />>>space <br />>>paces <br />>>acesp <br />>>cespa</span><br />
<span style="font-size: large;">>>espac</span></blockquote><pre class="brush: plain">
<br />
#include <stdio.h> <br />#include <string.h> <br />#include <conio.h> <br />void main() <br />{ <br />char w[50],buf[50],temp[50],buf2[10]; <br />clrscr(); <br />printf("Enter a word to see it's rotation :"); <br />fflush(stdin); <br />gets(w); <br />strcpy(temp,w); <br />printf("All the rotation of the word \"%s\" are :",w); <br />for(int i=0;i<strlen(w);i++) <br />{ <br />strcpy(buf,strnset(w,' ',i)); <br />for(int j=0;j<i;j++) <br />buf2[j]=temp[j]; <br />buf2[j]='\0'; <br />strcat(buf,buf2); <br />//To straighten the output <br />gotoxy(strlen(w)-i,4+i); <br />puts(buf); <br />} <br />getch(); <br />}<br /></div>
</pre>adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-35120931103527860802012-09-14T00:20:00.001-07:002012-09-14T00:20:13.581-07:00C++ Program to input any string and print the number of words<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to input any string and print the number of words</span></blockquote><pre class="brush: plain">
<br />
#include<iostream.h><br />#include<conio.h><br />#include<stdio.h><br />#include<string.h><br />main()<br />{<br />char a,name[50];<br />int l=0,c=0,word=0;<br />cout<<"Enter any string "<<endl;<br />gets(name);<br />l = strlen(name);<br />cout<<endl;<br />for(int i=0;i<l;i++)<br />{<br />a=name[i];<br />if (a==' ') c = c + 1;<br />}<br />word = c + 1;<br />cout<<"The total number of words in the string is "<<word;<br />cout<<endl;<br />getch();<br />return 0;<br /><br />}</div>
</pre>adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-29893663347995174872012-09-14T00:19:00.000-07:002012-09-14T00:19:19.993-07:00C++ Program to delete the first common word in two strings and display the strings without the first common words<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to delete the first common word in two strings and display the strings without the first common words</span></blockquote>
<pre class="brush: plain">
#include <conio.h>
#include <stdio.h>
#include <iostream.h>
char string1[25] = {'\0'};
char string2[25] = {'\0'};
char temp[25] = {'\0'};
int start = -1;
int end = -1;
int start2 = 0;
int end2 = 0;
/*GET THE INPUT FOR THE STRINGS*/
void get_input()
{
cout << "Enter the first string : ";
gets(string1);
cout << "Enter the second string : ";
gets(string2);
}
/*SET INDEXES FOR ALIAS WORD*/
void extract_word()
{
while( string2[end2] != ' ' )
end2++;
}
/*COMPARE THE TWO WORDS*/
int compare()
{
int n;
for(n=start; n<end; n++)
{
if( string2[n-start] != string1[n] )
{
return 0;
}
}
return 1;
}
/*FIND THE ALIAS WORD IN THE STRINGS*/
void find_alias()
{
int same = 0;
while( (same != 1) && (string1[end] != '\0') )
{
end++;
start = end;
while( (string1[end] != ' ') && (string1[end] != '\0') )
end++;
same = compare();
}
}
/*REPLACE THE WORD*/
void replace_alias()
{
int counter = end;
/*find the end of the string*/
while( string1[counter] != '\0' )
counter++;
/*copy the remaining string to temp*/
for(int i=end; i<counter; i++)
{
temp[i-end] = string1[i];
}
counter = start;
/*nullify the remaining string*/
while( string1[counter] != '\0' )
{
string1[counter] = '\0';
counter++;
}
start2 = end2;
counter = start-1;
/*replace the alias by the second string*/
while( string2[end2] != '\0' )
{
string1[counter] = string2[end2];
end2++;
counter++;
}
int k = 0;
/*copy the remaining string back from temp*/
while( temp[k] != '\0' )
{
string1[counter] = temp[k];
k++;
counter++;
}
}
void main()
{
clrscr();
get_input();
extract_word();
find_alias();
replace_alias();
cout << string1 << '\n';
getch();
} </pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-46014888882446715982012-09-14T00:18:00.000-07:002012-09-14T00:18:11.843-07:00C++ Program to implement a Recursive Function<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to implement a Recursive Function</span></blockquote><pre class="brush: plain">
<br />
#include <iostream.h><br />#include <string.h><br />#include <stdlib.h><br />#include <conio.h><br />void recurfunc(int start,int stop,char* buff);<br />void main()<br /><br /><br /> { clrscr();<br /> cout << "enter how many times to loop: ";<br /> char buff[100];<br /> cin >> buff;<br /> int num;<br /> num = atoi(buff);<br /> if(num >= 1)<br /><br /><br /> {<br /> recurfunc(0,num," this is a recursive function");<br /> }<br /> else<br /><br /><br /> {<br /> cout << "sorry you didnt enter valid data" << endl;<br /> return;<br /> }<br /> getch();<br /> }<br /> void recurfunc(int start,int stop,char* buff)<br /><br /><br /> {<br /> if(start < stop)<br /><br /><br /> {<br /> start++;<br /> cout << "\n" << buff << "\n";<br /> recurfunc(start,stop,buff);<br /> }<br /> else<br /><br /><br /> {<br /> return;<br /> }<br /> }</div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-84978308606277101032012-09-14T00:17:00.000-07:002012-09-14T00:17:05.293-07:00C++ Program to Print out a diamond of any size less than 12<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to Print out a diamond of any size less than 12</span></blockquote><pre class="brush: plain">
<br />
#include <iostream.h><br />
#include <conio.h><br />
const int Center = 20;<br />
<br />
void printnc(char c, int n){<br />
for (int lcv=0; lcv < n; lcv++)<br />
{<br />
cout << c;<br />
}<br />
}<br />
<br />
// Print out a triangle of size n<br />
void printTriangle(int n){<br />
<br />
for (int i=0; i < n; i++){<br />
printnc(' ', Center - i -1);<br />
printnc('X', 2*i+1);<br />
cout << endl;<br />
}<br />
}<br />
<br />
// Print reverse of triangle printed by printTriangle<br />
void printRTriangle(int n){<br />
<br />
for (int i=0; i < n; i++){<br />
printnc(' ', Center - n + i);<br />
printnc('X', 2*n-2*i-1);<br />
cout << endl;<br />
}<br />
}<br />
<br />
<br />
// Get dimension of triangle from user<br />
void main(void){<br />
int m;<br />
<br />
cout << "Enter an integer m [0 < m < 12]: "; endl;<br />
cin >> m;<br />
while ((m > 0) && (m < 12)){<br />
printTriangle(m);<br />
printRTriangle(m-1);<br />
cout << "Enter an integer m [0 < m < 12]: ";<br />
cin >> m;<br />
}<br />
}</div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-3904385186079931692012-09-14T00:15:00.003-07:002012-09-14T00:15:48.016-07:00C++ Program to print out a checkered board of size n<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to print out a checkered board of size n</span></blockquote><pre class="brush: plain">
<br />
#include <iostream.h><br />#include <conio.h><br /><br />const int cellSize = 4;<br />void printnc(char c, int n){<br /> for(int k = 0; k<n; ++k)<br /> cout << c;<br />}<br /><br />void printBWcells(void){<br /> printnc('.', cellSize);<br /> printnc(' ', cellSize);<br />}<br /><br />void printWBcells(void){<br /> printnc(' ', cellSize);<br /> printnc('.', cellSize);<br />}<br /><br />void printBoard(int n){<br /> printnc('*', 2+2*n*cellSize);<br /> cout << endl;<br /> for(int k = 0; k<n; ++k){<br /> for(int h = 0; h < cellSize; ++h){<br /> cout << '*';<br /> for(int m=0; m<n; ++m){<br /> if((k%2)==0)<br /> printBWcells();<br /> else<br /> printWBcells();<br /> }<br /> cout << '*' << endl;<br /> }<br /> }<br /> printnc('*', 2+2*n*cellSize);<br /> cout << endl;<br />}<br /><br />void main(void){<br /> int n;<br /> clrscr();<br /><br /> cout << "Enter size of board: ";<br /> cin >> n;<br /> clrscr();<br /><br /> printBoard(n);<br /> cout<<endl;<br /> cout<<"Press any key to continue";<br /> getch();<br />}<br />
<br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-53131042610301063282012-09-14T00:14:00.004-07:002012-09-14T00:14:50.316-07:00C++ Program to play a puzzle<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to play a puzzle</span></blockquote><pre class="brush: plain">
<br />
<br />#include<graphics.h><br />#include<iostream.h><br />#include<conio.h><br />#include<dos.h><br />#include<string.h><br />#include<stdio.h><br />getkey1()<br />{union REGS i,o;<br />while(!kbhit());<br />i.h.ah=0;<br />int86(22,&i,&o);<br />return(o.h.ah);<br />}<br />void main2()<br />{int gd=DETECT,gm,i,j,n=0,m,q=0,v=0,k;<br />char *a[16]={"9","3","2","4","7","6","5","8","1","11" ,"13","12","10","14"," " ,"15"}<br /><br />,*b[16]={"1","2","3","4","5","6","7","8","9","10" ,"11","12","13","14","15" ," "},*t;<br />initgraph(&gd,&gm,"c:\\tc\\bgi");<br />setcolor(3);<br />outtextxy(260,100," PUZZLE");<br />setcolor(4);<br />setcolor(WHITE);<br />delay(2000);<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />do{{ setcolor(3);<br />outtextxy(100,170,"YOU HAVE TO SOLVE IT WITHIN 400 MOVES");<br /><br />setcolor(8);<br />outtextxy(280,130,"LEVEL: 2 ");<br />setcolor(9);<br />outtextxy(100,150,"YOU HAVE SPENT ");<br />//outtextxy(220,150,v);<br />gotoxy(28,10);<br />cout<<v;<br />outtextxy(240,150," MOVES ");<br />setcolor(2);<br />outtextxy(100,330,"USE ARROW KEYS FOR DIRECTION");<br />setcolor(4);<br />outtextxy(200,350,"PRESS '* ' TO QUIT AT ANY TIME");<br />setcolor(5);<br />outtextxy(400,50,"ARRANGE LIKE THIS");<br />m=0;<br />for(i=425;i<=500;i+=25)<br />for(j=60;j<=135;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,b[m]);<br />m++;<br />}<br />}<br />setcolor(WHITE);<br />if((*a[0]=='1')&&(*a[1]=='2')&&(*a[2]=='3')&&(*a[3]=='4')&&(*a[4]=='5')&&(*a[5]=='6')&&(*a[6]=='7')&&(*a[7]=='8')<br />&& (*a[8]=='9')&&(strcmp(a[9],"10")==0)&&(strcmp(a[10],"11")==0)&&(strcmp(a[11],"12")==0)&&(strcmp(a[12],"13")==0)&&(strcmp(a[13],"14")==0)&&(strcmp(a[14],"15")==0))<br /><br />{setcolor(5);<br />outtextxy(200,350,"CONGRATULATION! YOU WIN");<br />getch();<br />break;<br />}<br />k=getkey1();<br />sound(500);<br />delay(100);<br />nosound();<br />switch(k)<br />{case 75:{clearviewport();<br />n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />if ((*a[n]==' ')&&(n<=11)&&(q==0))<br />{t=a[n];<br />a[n]=a[n+4];<br />a[n+4]=t;<br />q=1;<br />v++;<br />}<br />n++;<br />} n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />q=0; break;<br />}<br />case 77:{clearviewport();<br />n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />if ((*a[n]==' ')&&(n>3)&&(q==0))<br />{t=a[n];<br />a[n]=a[n-4];<br />a[n-4]=t;<br />q=1;<br />v++;<br />}<br />n++;<br />} n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />q=0;break;<br />}<br />case 80: {clearviewport();<br />n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />if ((*a[n]==' ')&&((n!=0)&&(n!=4)&&(n!=8)&&(n!=12))&&(q==0))<br />{t=a[n];<br />a[n]=a[n-1];<br />a[n-1]=t;<br />q=1;<br />v++;<br />}<br />n++;<br />} n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />q=0;break;<br />}<br />case 72:{clearviewport();<br />n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />if ((*a[n]==' ')&&(n!=3)&&(n!=7)&&(n!=11)&&(n!=15)&&(q==0))<br />{t=a[n];<br />a[n]=a[n+1];<br />a[n+1]=t;<br />q=1;<br />v++;<br />}<br />n++;<br />} n=0;<br />for(i=250;i<=325;i+=25)<br />for(j=200;j<=275;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />q=0; break;<br />}<br />}}while((k!=55)&&(v<=400));<br />if(v>400) {outtextxy(200,350,"SORRY! YOUR MOVE IS OVER");<br />getch();<br />}<br />closegraph();<br />}<br /><br />//puzz6.cpp ends here.<br /><br /><br /><br /><br /><br />#include<graphics.h><br />#include<iostream.h><br />#include<conio.h><br />#include<dos.h><br />#include<string.h><br />#include<stdio.h><br />getkey()<br />{union REGS i,o;<br />while(!kbhit());<br />i.h.ah=0;<br />int86(22,&i,&o);<br />return(o.h.ah);<br />}<br />void main()<br />{int gd=DETECT,gm,i,j,n=0,m,q=0,v=0,k;<br />char *a[9]={"7","2","5","4","3","6","1"," ","8"}<br /><br />,*b[9]={"1","2","3","4","5","6","7","8"," "},*t;<br />initgraph(&gd,&gm,"..//bgi");<br />setcolor(3);<br />outtextxy(260,100," PUZZLE");<br />setcolor(4);<br />setcolor(WHITE);<br />delay(2000);<br />for(i=200;i<=250;i+=25)<br />for(j=200;j<=250;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,a[n]);<br />n++;<br />}<br />do{{ setcolor(3);<br />outtextxy(100,170,"YOU HAVE TO SOLVE IT WITHIN 200 MOVES");<br />setcolor(1);<br />outtextxy(210,130,"LEVEL : 1");<br />setcolor(9);<br />outtextxy(100,150,"YOU HAVE SPENT ");<br />//outtextxy(220,150,v);<br />gotoxy(28,10);<br />cout<<v;<br />outtextxy(240,150," MOVES ");<br /><br />setcolor(2);<br />outtextxy(100,330,"USE ARROW KEYS FOR DIRECTION");<br />setcolor(4);<br />outtextxy(100,350,"PRESS '* ' TO QUIT AT ANY TIME");<br />setcolor(5);<br />outtextxy(400,50,"ARRANGE LIKE THIS");<br />m=0;<br />for(i=425;i<=475;i+=25)<br />for(j=60;j<=110;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+8,j+10,b[m]);<br />m++;<br />}<br />}<br />setcolor(WHITE);<br />if((*a[0]=='1')&&(*a[1]=='2')&&(*a[2]=='3')&&(*a[3]=='4')&&(*a[4]=='5')&&(*a[5]=='6')&&(*a[6]=='7')&&(*a[7]=='8'))<br /><br />{setcolor(5);<br /><br />outtextxy(180,380,"CONGRATULATION! YOU FINISHED LEVEL 1");<br />getch();<br />clearviewport();<br />main2();<br />break;<br />}<br />k=getkey();<br />sound(300);<br />delay(100);<br />nosound();<br />switch(k)<br />{case 75:{clearviewport();<br />n=0;<br />for(i=200;i<=250;i+=25)<br />for(j=200;j<=250;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />if ((*a[n]==' ')&&(n<=5)&&(q==0))<br />{t=a[n];<br />a[n]=a[n+3];<br />a[n+3]=t;<br />q=1;<br />v++;<br />}<br />n++;<br />} n=0;<br />for(i=200;i<=250;i+=25)<br />for(j=200;j<=250;j+=25)<br />{rectangle(i,j,i+25,j+25);<br />outtextxy(i+10,j+10,a[n]);<br />n++;<br /><br />}<br />q=0; break;<br />} <br />case 77:{clearviewport(); <br />n=0; <br />for(i=200;i<=250;i+=25) <br />for(j=200;j<=250;j+=25) <br />{rectangle(i,j,i+25,j+25); <br />if ((*a[n]==' ')&&(n>=2)&&(q==0)) <br />{t=a[n]; <br />a[n]=a[n-3]; <br />a[n-3]=t; <br />q=1; <br />v++;<br />}<br />n++; <br />} n=0; <br />for(i=200;i<=250;i+=25) <br />for(j=200;j<=250;j+=25) <br />{rectangle(i,j,i+25,j+25); <br />outtextxy(i+10,j+10,a[n]); <br />n++; <br />} <br />q=0;break; <br />} <br />case 80: {clearviewport(); <br />n=0;<br />for(i=200;i<=250;i+=25)<br />for(j=200;j<=250;j+=25) <br />{rectangle(i,j,i+25,j+25); <br />if ((*a[n]==' ')&&((n!=0)&&(n!=3)&&(n!=6))&&(q==0)) <br />{t=a[n]; <br />a[n]=a[n-1]; <br />a[n-1]=t; <br />q=1; <br />v++; <br />} <br />n++; <br />} n=0; <br />for(i=200;i<=250;i+=25)<br />for(j=200;j<=250;j+=25)<br />{rectangle(i,j,i+25,j+25); <br />outtextxy(i+10,j+10,a[n]); <br />n++; <br />} <br />q=0;break; <br />} <br />case 72:{clearviewport(); <br />n=0; <br />for(i=200;i<=250;i+=25) <br />for(j=200;j<=250;j+=25) <br />{rectangle(i,j,i+25,j+25); <br />if ((*a[n]==' ')&&((n!=2)&&(n!=5)&&(n!=8))&&(q==0))<br />{t=a[n];<br />a[n]=a[n+1]; <br />a[n+1]=t; <br />q=1; <br />v++; <br />} <br />n++; <br />} n=0; <br />for(i=200;i<=250;i+=25) <br />for(j=200;j<=250;j+=25) <br />{rectangle(i,j,i+25,j+25); <br />outtextxy(i+10,j+10,a[n]); <br />n++;<br />}<br />q=0; break; <br />} <br />}}while((k!=55)&&(v<=200)); <br />if(v>200) {outtextxy(200,350,"SORRY! YOUR MOVE IS OVER"); <br />delay(2000); <br />getch(); <br />} <br />closegraph(); <br />} </div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-15476788810692170082012-09-14T00:13:00.002-07:002012-09-14T00:13:31.218-07:00C++ Program for converting an int variable to floating point<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program for converting an int variable to floating point</span></blockquote><pre class="brush: plain">
<br />
#include <iostream.h><br />#include <stdlib.h> //defines EXIT_SUCCESS etc<br />#include <conio.h><br /><br />int main( void )<br />{<br /> // declare variables here<br /><br /> int x,y;<br /> float quotient;<br /> cout <<"enter an integer x="; cin >> x;<br /> cout <<"enter an integer y="; cin >> y;<br /><br /> quotient= x / y;<br /> cout<< "x / y is " << quotient << endl;<br /><br /> quotient= float(x) / y;<br /> cout<< "float(x) / y is " << quotient << endl;<br /> getch();<br /><br /><br /> return EXIT_SUCCESS;<br />}<br /><br /><br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-62619629010397296462012-09-14T00:12:00.003-07:002012-09-14T00:12:35.018-07:00C++ Program to print the product of two matrices <div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to print the product of two matrices </span></blockquote><pre class="brush: plain">
<br />
<br />
#include<iostream.h><br />#include<conio.h><br />main()<br />{<br />clrscr();<br />int i,j,a[3][4],b[4][3],c[3][3];<br />//Creation of matrix A[3][4]<br />cout<<"Enter elements of array A"<<endl;<br />for(i=0;i<3;i++)<br />{<br />for(j=0;j<4;j++)<br />{<br />cin>>a[i][j];<br />}<br />}<br />cout<<"Enter elements of array B"<<endl;<br />for(i=0;i<4;i++)<br />{<br />for(j=0;j<3;j++)<br />{<br />cin>>b[i][j];<br />}<br />}<br />// storing product in array C<br />for (i=0;i<3;i++)<br />{<br />for (j=0;j<3;j++)<br />{<br />c[i][j]=0;<br />for(int k=0;k<4;k++)<br />{<br />c[i][j]=a[i][k]*b[k][j]+c[i][j];<br />}<br />}<br />}<br />cout<<endl<<"The matrix A is "<<endl;<br />for(i=0;i<3;i++)<br />{<br />for(j=0;j<4;j++)<br />{<br />cout<<a[i][j]<<" ";<br />}<br />cout<<endl;<br />}<br />cout<<endl<<"The matrix B is "<<endl;<br />for(i=0;i<4;i++)<br />{<br />for(j=0;j<3;j++)<br />{<br />cout<<b[i][j]<<" ";<br />}<br />cout<<endl;<br />}<br />cout<<endl<<"The matrix C is "<<endl;<br />for(i=0;i<3;i++)<br />{<br />for(j=0;j<3;j++)<br />{<br />cout<<c[i][j]<<" ";<br />}<br />cout<<endl;<br />}<br /><br />getch();<br />return 0;<br />}</div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-80506637616144506772012-09-14T00:11:00.003-07:002012-09-14T00:11:36.014-07:00C++ Program to assign string in a double dimensional array and display the contents<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to assign string in a double dimensional array and display the contents</span></blockquote><pre class="brush: plain">
<br />
#include <iostream.h><br />#include <conio.h><br /><br /><br />enum {NAMESIZE=20};<br /><br />// Print out the first n names of a<br />void printNames(char a[][NAMESIZE], int n)<br />{<br /> for (int row=0; row<n; row++)<br /> {<br /> for (int clmn=0; a[row][clmn] != '\0'; clmn++)<br /> {<br /> cout << a[row][clmn];<br /> }<br /> cout << endl;<br /> }<br />}<br /><br />// Print out the first n names of a<br />void printNames(char *a[], int n)<br />{<br /> for (int k=0; k<n; k++)<br /> {<br /> cout << a[k] << endl;<br /> }<br />}<br /><br />void main(void)<br />{<br /> char names1[][NAMESIZE] = {"ankur", "rose", "simran", "gauri"};<br /> char *names2[] = {"lallan", "ballan", "sonal", "monika"};<br /><br /> cout << "The size of names1 is " << sizeof(names1) << endl;<br /> cout << "The size of names2 is " << sizeof(names2) << endl;<br /> getch();<br /><br /><br /> cout << endl << "Printing out: char names1[][NAMESIZE]" << endl;<br /> printNames(names1, 4);<br /><br /> cout << endl << "Printing out: char *names[]" << endl;<br /> printNames(names2, 4);<br /> getch();<br /><br /> cout << endl << "Printing out: names1[row]" << endl;<br /> for (int row=0; row < 4; row++)<br /> {<br /> cout << names1[row] << endl;<br /> }<br /><br /> cout << endl << "Printing out: names2[row]" << endl;<br /> for (row=0; row < 4; row++)<br /> {<br /> cout << names2[row] << endl;<br /> }<br /><br /> getch();clrscr();<br />}</div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-50116269950989153002012-09-14T00:10:00.000-07:002012-09-14T00:10:22.061-07:00C++ program to calculates the value of a polynomial<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ program to calculates the value of a polynomial</span></blockquote>
<pre class="brush: plain">
#include <iostream.h>
#include <conio.h>
#include <process.h>
const int MAXDEGREE = 10; // define constant
void main()
{
float x, y;
float coefficients[MAXDEGREE+1]; // coefficients of a polynomial
float x_powers[MAXDEGREE+1]; // powers of x
int degree, i;
cout << "\nCalculation of polynomial";
cout << "\nEnter degree ";
cin >> degree;
if (degree > MAXDEGREE || degree < 0)
{
cout << "\nError"; getch(); exit(0);
}
// read coefficients, highest first:
for (i = degree; i >= 0; i--)
{
cout << "\nEnter coefficient " << i << " ";
cin >> coefficients[i];
}
// read x:
cout << "\nEnter x ";
cin >> x;
// calculate powers of x
x_powers[0] = 1;
for (i=1; i <= degree; i++)
{
x_powers[i] = x_powers[i-1] * x;
}
// calculate polynomial
y = 0;
for (i = 0; i <= degree; i++)
{
y = y + coefficients[i] * x_powers[i];
}
// write result
cout << "\n\nResult is " << y;
// wait for key pressure and exit
getch();
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-28611954646436956362012-09-14T00:08:00.003-07:002012-09-14T00:08:59.381-07:00C++ Program for Pig Latin Converter<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program for Pig Latin Converter</span></blockquote><pre class="brush: plain">
<br />
<br />
#include <iostream.h><br />#include <string.h><br />#include <stdio.h><br />#include <conio.h><br /><br />int makePhrase(char * word, char phrase[][20]);<br /><br />void main()<br />{<br />clrscr();<br /> char word[30] = {'\0'};<br /> char phrase[20][20];<br /> char convert[30] = {'\0'};<br /> char temp[10] = {'\0'};<br /> int counter =0;<br /> int check = 0;<br /> int firstvowel = 0;<br /> int i;<br /> int numcons;<br /><br /> cout<<"Please enter a word or phrase up to 30 characters"<<endl;<br /> cin.getline(word,30,'\n');<br /> strlwr(word);<br /> cout<<"\nYour entry was '"<<word<<"'"<<endl;<br /> cout<<"---------------------------"<<endl;<br /><br /> i=makePhrase(word,phrase);<br /><br /> for (int k=0; k<i; k++)<br /> {<br /> int size = strlen(phrase[k]);<br /><br /> for(int j=0;j<size;j++)<br /> {<br /><br /> switch(phrase[k][j])<br /> {<br /> case 'a':<br /> if (j == 0)<br /> firstvowel = 1;<br /><br /> check = 1;<br /> break;<br /> case 'e':<br /> if (j == 0)<br /> firstvowel = 1;<br /><br /> check = 1;<br /> break;<br /> case 'i':<br /> if (j == 0)<br /> firstvowel = 1;<br /><br /> check = 1;<br /> break;<br /> case 'o':<br /> if (j == 0)<br /> firstvowel = 1;<br /><br /> check = 1;<br /> break;<br /> case 'u':<br /> if (j == 0)<br /> firstvowel = 1;<br /><br /> check = 1;<br /> break;<br /> default:<br /> if (check != 1 && firstvowel != 1)<br /> counter++;<br /> break;<br /><br /><br /> }<br /><br /><br /> };<br /> if (firstvowel == 1)<br /> {<br /> strcat(phrase[k],"hay");<br /> cout<<"Word begins with a vowel, no need for movement"<<endl;<br /> cout<<"Your word in Pig Latin is\n"<<phrase[k]<<endl;<br /> cout<<"---------------------------"<<endl;<br /> }<br /><br /> else<br /> {<br /> numcons = counter-1;<br /> cout<<"The first vowel is: "<<phrase[k][counter]<<endl;<br /> cout<<"The letter(s) to move is:"<<endl;<br /><br /> do<br /> { cout<<phrase[k][numcons]<<endl;<br /> temp[numcons] = phrase[k][numcons];<br /> numcons-=1;<br /> }while(numcons !=-1);<br /><br /> int leftover = strlen(phrase[k]) - numcons;<br /><br /> for(int i=0; i<leftover; i++)<br /><br /> {<br /> convert[i] = phrase[k][counter];<br /> counter+=1;<br /> };<br /> strcat(convert, temp);<br /> strcat(convert, "ay");<br /> strcpy(phrase[k],convert);<br />cout<<"Your word in Pig Latin is:\n"<<phrase[k]<<endl;<br />cout<<"---------------------------"<<endl;<br /> };<br /> numcons=0;<br /> counter=0;<br /> firstvowel=0;<br /> size=0;<br /> check = 0;<br /> strcpy(temp,"0");<br /> };<br /><br /><br /><br /> cout<<"\n\nYour translated entry:\n";<br /> cout<<"--------------\n";<br /> for(int a=0;a<i;a++)<br /> {<br /> cout<<phrase[a]<<" ";<br /> };<br /> cout<<"\n--------------"<<endl;<br />};<br /><br />int makePhrase(char * word, char phrase[][20])<br />{<br />int i=0;<br />char *space = " ";<br />char *breaker;<br />breaker = strtok(word,space);<br /> while ( breaker )<br /> {<br /> strcpy( phrase[i],breaker );<br /> breaker = strtok( NULL, space );<br /> i++;<br /> };<br /> return i;<br />};<br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-87701113561323759322012-09-14T00:07:00.002-07:002012-09-14T00:07:36.067-07:00C++ Program to input any string and print the number of spaces stored within the string at prime positions<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to input any string and print the number of spaces stored within the string at prime positions</span></blockquote><pre class="brush: plain">
<br />
#include<iostream.h><br />#include<conio.h><br />#include<stdio.h><br />#include<string.h><br />main()<br />{<br />char a,name[50];<br />int f=0, l=0,c=0,k=0;<br />cout<<"Enter any string "<<endl;<br />gets(name);<br />l = strlen(name);<br />cout<<"The length of the string is "<<l;<br />cout<<endl;<br />for(int i=0;i<l;i++)<br />{<br />a=name[i];<br />if (a==' ')<br />// checking if i is prime<br />k=i+1;<br />for(int l=1;l<=k;l++)<br />{<br />if (k%l==0)<br />f=f+1;<br />}<br />if (f==2)<br />c = c + 1;<br />f=0;<br />}<br />cout<<endl<<"The no. of spaces at prime position is "<<c;<br />getch();<br />return 0;<br /><br />}<br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-49637752510630765232012-09-14T00:06:00.000-07:002012-09-14T00:06:11.539-07:00C++ Program to display a Triangle of numbers called the Pascal's Triangle<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to display a Triangle of numbers called the Pascal's Triangle, when provided with the number of rows</span></blockquote><pre class="brush: plain">
<br />
# include <stdio.h><br />#include<conio.h><br />void main () <br />{ <br />int pal[50][50]; <br />int i,j,k,n; <br />printf("ENTER THE NUMBER OF ROWS : "); <br />scanf("%d",&n); <br />for (i=0;i<n;i++) <br />{ <br />pal[i][0]=1; <br />pal[i][i]=1; <br />for (j=1;j<i;j++) <br />{ <br />pal[i][j]=pal[i-1][j-1]+pal[i-1][j]; <br />} <br />for (j=1;j<=(n-(i+1));j++) <br />{ <br />printf (" "); <br />} <br />for (k=0;k<=i;k++) <br />{ <br />printf(" %2d ",pal[i][k]); <br />} <br />printf("\n"); <br />} <br />getch(); <br />}<br /></div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-62190894381297078302012-09-14T00:04:00.002-07:002012-09-14T00:04:32.932-07:00C++ Program to display all prime fibonacci series within the range of 1 to 10000<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to display all prime fibonacci series within the range of 1 to 10000</span></blockquote>
<pre class="brush: plain">
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
int isprime(int);
main()
{
clrscr();
cout<<"All prime fibonacci series in the range of 1 to 10000 are"<<endl;
int r;
int a=1,b=2,c=0;
r=isprime(a);
if (r==1) cout<<a<<" ";
r=isprime(b);
if (r==1) cout<<b<<" ";
while (c<=10000)
{
c=a+b;
r=isprime(c);
if ((r==1) && (c<=10000))
cout<<c<<" ";
a=b;
b=c;
}
getch();
}
int isprime(int x)
{
int i;
if (x==1) return 0;
else
{
int p=1;
for(i=2;i<x;i++)
{
if (x%i==0)
p=2;
}
return (p);
}
} </pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-63210424810831055542012-09-14T00:03:00.000-07:002012-09-14T00:03:18.811-07:00C++ Program to Conversion program using Fucntions<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to Conversion program using Fucntions </span></blockquote>
<pre class="brush: plain">
#include <iostream.h>
#include <stdlib.h>
char choosestd;
float inch1;
float inch2;
float foot;
float yard;
float mile;
float millimeter;
float centimeter;
float meter1;
float meter2;
float kilometer;
int first;
float firstfunction();
float secondfunction();
float thirdfunction();
float fourthfunction();
float fifthfunction();
float sixthfunction();
float seventhfunction();
float eigthfunction();
float ninthfunction();
float tenthfunction();
int main()
{
clrscr();
cout << "*-------------------------------------------------------------*\n";
cout << " \n\n\n";
cout << "To (q)uit any time type enter \"q\"\n\n";
cout << "To convert from Standard Measurments to Metric enter \"1\": \n";
cout << "To convert from Metric to Standard Measurments enter \"2\": \n";
cin >> first;
if (first == 1)
{
int choosestd;
cout << "What would you like to convert?\n";
cout << "(1)Inches to Millimeters: \n";
cout << "(2)Inches to Centimeters: \n";
cout << "(3)Feet to Meters: \n";
cout << "(4)Yards to Meters: \n";
cout << "(5)Miles to Kilometers: \n";
cin >> choosestd;
if (choosestd == 1)
{
cout << "\nEnter the number of inches you wish converted: \n";
cin >> inch1;
cout << "You entered " << inch1 ;
cout<< " inches, which equals " << firstfunction() << " millimeters.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 2)
{
cout << "\nEnter the number of inches you wish converted: \n";
cin >> inch2;
cout << "You entered " << inch2 << " inches, which equals " << secondfunction() << " centimeters.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 3)
{
cout << "\nEnter the number of feet you wish converted: \n";
cin >> foot;
cout << "You entered " << foot << " feet, which equals " << thirdfunction() << " meters.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 4)
{
cout << "\nEnter the number of yards you wish converted: \n";
cin >> yard;
cout << "You entered " << yard << " yards, which equals " << fourthfunction() << " meters.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 5)
{
cout << "\nEnter the number of miles you wish converted: \n";
cin >> mile;
cout << "You entered " << mile << " miles, which equals " << fifthfunction() << " kilometers.\n\n";
system("PAUSE");
return main();
}
else if ((choosestd != 1) || (choosestd !=2) || (choosestd !=3) || (choosestd !=4) || (choosestd !=5))
{
cout<<endl;
cout << "\n\nThank you for using this program.\n\n";
cout<<"endl";
getch();
return 0;
}
}
else if (first == 2)
{
int choosestd;
cout << "What would you like to convert?\n";
cout << "(1)Millimeters to Inches: \n";
cout << "(2)Centimeters to Inches: \n";
cout << "(3)Meters to Feet: \n";
cout << "(4)Meters to Yards: \n";
cout << "(5)Kilometers to Miles: \n";
cin >> choosestd;
if (choosestd == 1)
{
cout << "\nEnter the number of millimeters you wish converted: \n";
cin >> millimeter;
cout << "You entered " << millimeter << " millimeters, which equals " << sixthfunction() << " inches.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 2)
{
cout << "\nEnter the number of centimeters you wish converted: \n";
cin >> centimeter;
cout << "You entered " << centimeter << " centimeters, which equals " << seventhfunction() << " inches.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 3)
{
cout << "\nEnter the number of meters you wish converted: \n";
cin >> meter1;
cout << "You entered " << meter1 << " meters, which equals " << eigthfunction() << " feet.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 4)
{
cout << "\nEnter the number of meters you wish converted: \n";
cin >> meter2;
cout << "You entered " << meter2 << " meters, which equals " << ninthfunction() << " yards.\n\n";
system("PAUSE");
return main();
}
else if (choosestd == 5)
{
cout << "\nEnter the number of kilometers you wish converted: \n";
cin >> kilometer;
cout << "You entered " << kilometer << " kilometers, which equals " << tenthfunction() << " miles.\n\n";
system("PAUSE");
return main();
}
else if ((choosestd != 1) || (choosestd !=2) || (choosestd !=3) || (choosestd !=4) || (choosestd !=5))
{
int x;
cout << "\n\nThank you for using this program.\n\n";
cin >> x;
return 0;
}
}
else if ((first != 1) || (first != 2))
{
int x;
cout << "End Program.\n\n\nThis program was brought to you by\n http://www.mcarterbrown.com\n\n\n";
cout << "Thank you\n\n\n";
cin >> x;
return 0;
}
}
float firstfunction()
{
double x;
x = (inch1 * 25.4);
return x;
}
float secondfunction()
{
double x;
x = (inch2 * 2.54);
return x;
}
float thirdfunction()
{
float x;
x = (foot * .3048);
return x;
}
float fourthfunction()
{
float x;
x = (yard * .9144);
return x;
}
float fifthfunction()
{
float x;
x = (mile * 1.609);
return x;
}
float sixthfunction()
{
float x;
x = (millimeter / 25.4);
return x;
}
float seventhfunction()
{
float x;
x = (centimeter / 2.54);
return x;
}
float eigthfunction()
{
float x;
x = (meter1 / .3048);
return x;
}
float ninthfunction()
{
float x;
x = (meter2 / .9144);
return x;
}
float tenthfunction()
{
float x;
x = (kilometer / 1.609);
return x;
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-60836520940544308002012-09-13T21:27:00.001-07:002012-09-13T21:27:39.807-07:00C++ Program to design a Five Function Calculator using Switch/Case<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to design a Five Function Calculator using Switch/Case</span></blockquote>
<pre class="brush: plain">
#include <iostream.h>
#include <conio.h>
int main () {
main:
int a,b,c,d,ans;
double v1, v2, ans2;
char yn;
while (yn != 'n')
{
clrscr();
cout<<"\n\n\n\t-_-_-_-_-_-_-_-_- Five Function Calculator _-_-_-_-_-_-_-_-_\n\n";
cout<<"Select the operation .\n";
cout<<"1. Multipication\n";
cout<<"2. Division\n";
cout<<"3. Subtraction\n";
cout<<"4. Addition\n";
cout<<"5. Power\n";
cout<<"6. Exit\n";
cout<<"Enter a number: [1-6]";
cin>>ans;
switch (ans) {
case 1:
goto multipication;
break;
case 2:
goto division;
break;
case 3:
goto subtraction;
break;
case 4:
goto addition;
break;
case 5:
goto power;
break;
case 6:
cout<<"Thank You\n";
return 0;
}
multipication:
cout<<"\n\t\t==================Multipication===============\n";
cout<<"Enter your First Number: ";
cin>>v1;
cout<<"Enter your Second Number: ";
cin>>v2;
ans2=v1 * v2;
cout<<"Answer: "<<ans2<<"\n\n";
cout<<"Would like to solve another one <yn>: ";
cin>>yn;
goto main;
return 0;
division:
cout<<"\n\t\t==================Division===============\n";
cout<<"Enter your First Number: ";
cin>>v1;
cout<<"Enter your Second Number: ";
cin>>v2;
if (v2==0) {
cout<<"ERROR!!! You cannot divide anything by 0\n\n";
goto main;
}
ans2=v1 / v2;
cout<<"Answer: "<<ans2<<"\n\n";
cout<<"Would like to solve another one <yn>: ";
cin>>yn;
goto main;
return 0;
subtraction:
cout<<"\n\t\t==================Subtraction===============\n";
cout<<"Enter your First Number: ";
cin>>v1;
cout<<"Enter your Second Number: ";
cin>>v2;
ans2=v1 - v2;
cout<<"Answer: "<<ans2<<"\n\n";
cout<<"Would like to solve another one <yn>: ";
cin>>yn;
goto main;
return 0;
addition:
cout<<"\n\t\t==================Addition===============\n";
cout<<"Enter your First Number: ";
cin>>v1;
cout<<"Enter your Second Number: ";
cin>>v2;
ans2=v1 + v2;
cout<<"Answer: "<<ans2<<"\n\n";
cout<<"Would like to solve another one <yn>: ";
cin>>yn;
goto main;
return 0;
power:
cout<<"\n\t\t==================Power===============\n";
cout<<"Enter a number: ";
cin>>v1;
cout<<"Enter the Power: ";
cin>>v2;
ans2=v1;
for(int i=2; i<=v2; i++)
ans2 = ans2 * v1;
cout<<"Answer: "<<ans2<<"\n\n";
cout<<"Would like to solve another one <yn>: ";
cin>>yn;
goto main;
return 0;
}
return 0;
}</pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-72003021496137847062012-09-13T21:25:00.002-07:002012-09-13T21:25:54.123-07:00c++ Program to perform Magic Courtesy : ENRICO X<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to perform Magic Courtesy : ENRICO X THE MAGICIAN : Enrico Lorenzo</span></blockquote>
<pre class="brush: plain">
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
main()
{
clrscr();
_setcursortype(_NOCURSOR);
int x, x2=6, lo, di;
int x3=5, x4=3, x5=4;
char cho, col, col2, col3;
randomize();
clrscr();
sleep(2);
textcolor(15);
gotoxy(44,13);cprintf("X");
delay(100);
textcolor(0);
gotoxy(44,13);cprintf(" ");
textcolor(15);
gotoxy(42,13);cprintf("O");
delay(100);
textcolor(0);
gotoxy(42,13);cprintf(" ");
textcolor(15);
gotoxy(41,13);cprintf("C");
delay(100);
textcolor(0);
gotoxy(41,13);cprintf(" ");
textcolor(15);
gotoxy(40,13);cprintf("I");
delay(100);
textcolor(0);
gotoxy(40,13);cprintf(" ");
textcolor(15);
gotoxy(39,13);cprintf("R");
delay(100);
textcolor(0);
gotoxy(39,13);cprintf(" ");
textcolor(15);
gotoxy(38,13);cprintf("N");
delay(100);
textcolor(0);
gotoxy(38,13);cprintf(" ");
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
textcolor(0);
gotoxy(37,13);cprintf(" ");
delay(100);
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
textcolor(8);
gotoxy(37,13);cprintf("E");
textcolor(15);
gotoxy(38,13);cprintf("N");
delay(100);
textcolor(8);
gotoxy(38,13);cprintf("N");
textcolor(15);
gotoxy(39,13);cprintf("R");
delay(100);
textcolor(8);
gotoxy(39,13);cprintf("R");
textcolor(15);
gotoxy(40,13);cprintf("I");
delay(100);
textcolor(8);
gotoxy(40,13);cprintf("I");
textcolor(15);
gotoxy(41,13);cprintf("C");
delay(100);
textcolor(8);
gotoxy(41,13);cprintf("C");
textcolor(15);
gotoxy(42,13);cprintf("O");
delay(100);
textcolor(8);
gotoxy(42,13);cprintf("O");
textcolor(15);
gotoxy(44,13);cprintf("X");
delay(100);
textcolor(8);
gotoxy(44,13);cprintf("X");
sleep(2);
clrscr();
textcolor(15);
gotoxy(35,13);cprintf("T");
delay(100);
gotoxy(36,13);cprintf("H");
textcolor(8);
gotoxy(35,13);cprintf("T");
delay(100);
gotoxy(36,13);cprintf("H");
textcolor(15);
gotoxy(37,13);cprintf("E");
delay(100);
gotoxy(39,13);cprintf("M");
textcolor(8);
gotoxy(37,13);cprintf("E");
delay(100);
gotoxy(39,13);cprintf("M");
textcolor(15);
gotoxy(40,13);cprintf("%c", x2);
delay(100);
gotoxy(41,13);cprintf("G");
textcolor(8);
gotoxy(40,13);cprintf("%c", x2);
delay(100);
gotoxy(41,13);cprintf("G");
textcolor(15);
gotoxy(42,13);cprintf("I");
delay(100);
gotoxy(43,13);cprintf("C");
textcolor(8);
gotoxy(42,13);cprintf("I");
delay(100);
gotoxy(43,13);cprintf("C");
textcolor(15);
gotoxy(44,13);cprintf("I");
delay(100);
gotoxy(45,13);cprintf("%c", x3);
textcolor(8);
gotoxy(44,13);cprintf("I");
delay(100);
gotoxy(45,13);cprintf("%c", x3);
textcolor(15);
gotoxy(46,13);cprintf("N");
delay(100);
textcolor(8);
gotoxy(46,13);cprintf("N");
delay(100);
gotoxy(35,13);cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
gotoxy(39,13);cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
delay(100);
cprintf(" ");
sleep(2);
clrscr();
for(x=1; x<=50; x++)
{
textcolor(8);
gotoxy(random(80), random(25));cprintf("%c", x2);
delay(10);
gotoxy(random(80), random(25));cprintf("%c", x3);
delay(10);
textcolor(4);
gotoxy(random(80), random(25));cprintf("%c", x4);
delay(10);
gotoxy(random(80), random(25));cprintf("%c", x5);
delay(10);
}
intro:
clrscr();
textcolor(8);
gotoxy(1,1);cprintf(" nter");
gotoxy(73,25);cprintf(" redits");
gotoxy(68,1);cprintf("THE M%cGICI%cN", x2, x3);
gotoxy(1,25);cprintf("Best viewed in maximize window");
textcolor(15);
gotoxy(1,1);cprintf("E");
gotoxy(73,25);cprintf("C");
cho=getch();
if(cho=='e' || cho=='E')
{
clrscr();
for(lo=28; lo<=53; lo++)
{
textcolor(8);
gotoxy(lo,14);cprintf("ÛÛ");
}
for(lo=0, di=28; lo<=100; lo+=4, di++)
{
textcolor(15);
gotoxy(28,12);cprintf("initializing trick...");
gotoxy(28,13);cprintf("%d%", lo);
gotoxy(di,14);cprintf("ÛÛ");
delay(200);
}
sleep(2);
refresh:
clrscr();
textcolor(8);
gotoxy(35,1);cprintf("THE M%cGICI%cN", x2, x3);
textcolor(15);
gotoxy(27,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(27,3);cprintf("³ ³");
gotoxy(27,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,5);cprintf("³ ³");
gotoxy(27,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,7);cprintf("³ ³");
gotoxy(27,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,9);cprintf("³ ³");
gotoxy(27,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,11);cprintf("³ ³");
gotoxy(27,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,13);cprintf("³ ³");
gotoxy(27,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(27,15);cprintf("³ ³");
gotoxy(27,16);cprintf("³ ³");
gotoxy(27,17);cprintf("³ ³");
gotoxy(27,18);cprintf("ÀÄÄÄÄÄÄÙ");
gotoxy(37,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(37,3);cprintf("³ ³");
gotoxy(37,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,5);cprintf("³ ³");
gotoxy(37,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,7);cprintf("³ ³");
gotoxy(37,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,9);cprintf("³ ³");
gotoxy(37,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,11);cprintf("³ ³");
gotoxy(37,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,13);cprintf("³ ³");
gotoxy(37,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(37,15);cprintf("³ ³");
gotoxy(37,16);cprintf("³ ³");
gotoxy(37,17);cprintf("³ ³");
gotoxy(37,18);cprintf("ÀÄÄÄÄÄÄÙ");
gotoxy(47,2);cprintf("ÚÄÄÄÄÄÄ¿");
gotoxy(47,3);cprintf("³ ³");
gotoxy(47,4);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,5);cprintf("³ ³");
gotoxy(47,6);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,7);cprintf("³ ³");
gotoxy(47,8);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,9);cprintf("³ ³");
gotoxy(47,10);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,11);cprintf("³ ³");
gotoxy(47,12);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,13);cprintf("³ ³");
gotoxy(47,14);cprintf("ÃÄÄÄÄÄÄ´");
gotoxy(47,15);cprintf("³ ³");
gotoxy(47,16);cprintf("³ ³");
gotoxy(47,17);cprintf("³ ³");
gotoxy(47,18);cprintf("ÀÄÄÄÄÄÄÙ");
textcolor(8);
gotoxy(1,25);cprintf(" efresh");
textcolor(15);
gotoxy(1,25);cprintf("R");
gotoxy(35,20);cprintf("Pick a card!");
gotoxy(32,21);cprintf("Enter which column!");
textcolor(7);
gotoxy(33,17);cprintf("1");
gotoxy(43,17);cprintf("2");
gotoxy(53,17);cprintf("3");
textcolor(4);
x=3;
gotoxy(28,3);cprintf("K%c", x);
gotoxy(28,7);cprintf("3%c", x);
gotoxy(28,9);cprintf("Q%c", x);
gotoxy(28,11);cprintf("6%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(28,15);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(48,7);cprintf("A%c", x2);
gotoxy(28,5);cprintf("4%c", x2);
gotoxy(38,3);cprintf("2%c", x);
gotoxy(38,5);cprintf("J%c", x);
gotoxy(38,7);cprintf("K%c", x);
gotoxy(38,9);cprintf("8%c", x);
gotoxy(38,13);cprintf("3%c", x);
gotoxy(38,15);cprintf("5%c", x);
textcolor(4);
x=4;
gotoxy(38,11);cprintf("7%c", x);
gotoxy(48,3);cprintf("2%c", x);
gotoxy(48,5);cprintf("9%c", x);
gotoxy(48,9);cprintf("J%c", x);
gotoxy(48,11);cprintf("Q%c", x);
gotoxy(48,13);cprintf("5%c", x);
gotoxy(48,15);cprintf("6%c", x);
back:
col=getch();
if(col=='1')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(28,15);cprintf("7%c", x);
gotoxy(28,3);cprintf("2%c", x);
gotoxy(38,3);cprintf("9%c", x);
gotoxy(28,5);cprintf("J%c", x);
gotoxy(38,5);cprintf("Q%c", x);
gotoxy(48,5);cprintf("5%c", x);
gotoxy(28,7);cprintf("6%c", x);
textcolor(4);
x=3;
gotoxy(38,7);cprintf("K%c", x);
gotoxy(28,9);cprintf("3%c", x);
gotoxy(38,9);cprintf("Q%c", x);
gotoxy(48,9);cprintf("6%c", x);
gotoxy(28,11);cprintf("J%c", x);
gotoxy(38,11);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(48,3);cprintf("A%c", x2);
gotoxy(48,7);cprintf("4%c", x2);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(38,13);cprintf("K%c", x);
gotoxy(48,13);cprintf("8%c", x);
gotoxy(38,15);cprintf("3%c", x);
gotoxy(48,15);cprintf("5%c", x);
back2:
col2=getch();
if(col2=='1')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(38,11);cprintf("7%c", x);
gotoxy(38,7);cprintf("2%c", x);
gotoxy(48,11);cprintf("9%c", x);
gotoxy(48,7);cprintf("J%c", x);
gotoxy(28,13);cprintf("Q%c", x);
gotoxy(38,3);cprintf("5%c", x);
gotoxy(28,9);cprintf("6%c", x);
textcolor(4);
x=3;
gotoxy(38,13);cprintf("K%c", x);
gotoxy(38,9);cprintf("3%c", x);
gotoxy(48,13);cprintf("Q%c", x);
gotoxy(28,5);cprintf("6%c", x);
gotoxy(48,9);cprintf("J%c", x);
gotoxy(28,15);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(28,3);cprintf("A%c", x2);
gotoxy(48,3);cprintf("4%c", x2);
gotoxy(38,5);cprintf("2%c", x);
gotoxy(28,11);cprintf("J%c", x);
gotoxy(38,15);cprintf("K%c", x);
gotoxy(48,5);cprintf("8%c", x);
gotoxy(48,15);cprintf("3%c", x);
gotoxy(28,7);cprintf("5%c", x);
back3:
col3=getch();
if(col3=='2')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("3%c", x);
}
else if(col3=='3')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("J%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else
goto back3;
}
else if(col2=='2')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(48,15);cprintf("7%c", x);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(38,7);cprintf("9%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(48,7);cprintf("Q%c", x);
gotoxy(38,3);cprintf("5%c", x);
gotoxy(38,13);cprintf("6%c", x);
textcolor(4);
x=3;
gotoxy(28,9);cprintf("K%c", x);
gotoxy(48,13);cprintf("3%c", x);
gotoxy(38,9);cprintf("Q%c", x);
gotoxy(28,5);cprintf("6%c", x);
gotoxy(28,15);cprintf("J%c", x);
gotoxy(48,9);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(28,3);cprintf("A%c", x2);
gotoxy(48,3);cprintf("4%c", x2);
gotoxy(38,5);cprintf("2%c", x);
gotoxy(38,15);cprintf("J%c", x);
gotoxy(28,11);cprintf("K%c", x);
gotoxy(48,5);cprintf("8%c", x);
gotoxy(38,11);cprintf("3%c", x);
gotoxy(28,7);cprintf("5%c", x);
back4:
col3=getch();
if(col3=='1')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("K%c", x);
}
else if(col3=='2')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("Q%c", x);
}
else if(col3=='3')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("9%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else
goto back4;
}
else if(col2=='3')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(48,15);cprintf("7%c", x);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(28,3);cprintf("9%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(38,3);cprintf("Q%c", x);
gotoxy(48,7);cprintf("5%c", x);
gotoxy(38,13);cprintf("6%c", x);
textcolor(4);
x=3;
gotoxy(48,3);cprintf("K%c", x);
gotoxy(48,13);cprintf("3%c", x);
gotoxy(28,5);cprintf("Q%c", x);
gotoxy(38,9);cprintf("6%c", x);
gotoxy(28,15);cprintf("J%c", x);
gotoxy(38,5);cprintf("9%c", x);
textcolor(8);
x=5;
gotoxy(38,7);cprintf("A%c", x2);
gotoxy(28,9);cprintf("4%c", x2);
gotoxy(48,9);cprintf("2%c", x);
gotoxy(38,15);cprintf("J%c", x);
gotoxy(48,5);cprintf("K%c", x);
gotoxy(28,11);cprintf("8%c", x);
gotoxy(28,7);cprintf("3%c", x);
gotoxy(38,11);cprintf("5%c", x);
back5:
col3=getch();
if(col3=='1')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("4%c", x2);
}
else if(col3=='2')
{
clrscr();
x=3;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("6%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else
goto back5;
}
else if(col2=='r' || col2=='R')
goto refresh;
else
goto back2;
}
else if(col=='2')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(48,9);cprintf("7%c", x);
gotoxy(28,3);cprintf("2%c", x);
gotoxy(38,3);cprintf("9%c", x);
gotoxy(28,5);cprintf("J%c", x);
gotoxy(38,5);cprintf("Q%c", x);
gotoxy(48,5);cprintf("5%c", x);
gotoxy(28,7);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(48,3);cprintf("A%c", x2);
gotoxy(28,13);cprintf("4%c", x2);
gotoxy(38,7);cprintf("2%c", x);
gotoxy(48,7);cprintf("J%c", x);
gotoxy(28,9);cprintf("K%c", x);
gotoxy(38,9);cprintf("8%c", x);
gotoxy(28,11);cprintf("3%c", x);
gotoxy(38,11);cprintf("5%c", x);
textcolor(4);
x=3;
gotoxy(48,11);cprintf("K%c", x);
gotoxy(38,13);cprintf("3%c", x);
gotoxy(48,13);cprintf("Q%c", x);
gotoxy(28,15);cprintf("6%c", x);
gotoxy(38,15);cprintf("J%c", x);
gotoxy(48,15);cprintf("9%c", x);
back6:
col2=getch();
if(col2=='1')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(28,5);cprintf("7%c", x);
gotoxy(38,7);cprintf("2%c", x);
gotoxy(48,11);cprintf("9%c", x);
gotoxy(48,7);cprintf("J%c", x);
gotoxy(28,13);cprintf("Q%c", x);
gotoxy(38,3);cprintf("5%c", x);
gotoxy(28,9);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(28,3);cprintf("A%c", x2);
gotoxy(28,11);cprintf("4%c", x2);
gotoxy(38,13);cprintf("2%c", x);
gotoxy(48,3);cprintf("J%c", x);
gotoxy(38,9);cprintf("K%c", x);
gotoxy(48,13);cprintf("8%c", x);
gotoxy(48,9);cprintf("3%c", x);
gotoxy(28,15);cprintf("5%c", x);
textcolor(4);
x=3;
gotoxy(38,5);cprintf("K%c", x);
gotoxy(38,15);cprintf("3%c", x);
gotoxy(48,5);cprintf("Q%c", x);
gotoxy(38,11);cprintf("6%c", x);
gotoxy(48,15);cprintf("J%c", x);
gotoxy(28,7);cprintf("9%c", x);
back7:
col3=getch();
if(col3=='2')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("K%c", x);
}
else if(col3=='3')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("3%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else goto back7;
}
else if(col2=='2')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(28,5);cprintf("7%c", x);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(38,7);cprintf("9%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(48,7);cprintf("Q%c", x);
gotoxy(38,3);cprintf("5%c", x);
gotoxy(38,13);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(28,3);cprintf("A%c", x2);
gotoxy(38,15);cprintf("4%c", x2);
gotoxy(28,9);cprintf("2%c", x);
gotoxy(48,3);cprintf("J%c", x);
gotoxy(48,13);cprintf("K%c", x);
gotoxy(38,9);cprintf("8%c", x);
gotoxy(28,15);cprintf("3%c", x);
gotoxy(48,9);cprintf("5%c", x);
textcolor(4);
x=3;
gotoxy(38,5);cprintf("K%c", x);
gotoxy(28,11);cprintf("3%c", x);
gotoxy(48,5);cprintf("Q%c", x);
gotoxy(48,15);cprintf("6%c", x);
gotoxy(38,11);cprintf("J%c", x);
gotoxy(28,7);cprintf("9%c", x);
back8:
col3=getch();
if(col3=='1')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("2%c", x);
}
else if(col3=='2')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is an");
gotoxy(49,13);cprintf("!");
textcolor(8);
gotoxy(47,13);cprintf("8%c", x);
}
else if(col3=='3')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("5%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else goto back8;
}
else if(col2=='3')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=4;
gotoxy(38,9);cprintf("7%c", x);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(28,3);cprintf("9%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(38,3);cprintf("Q%c", x);
gotoxy(48,7);cprintf("5%c", x);
gotoxy(38,13);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(38,7);cprintf("A%c", x2);
gotoxy(38,15);cprintf("4%c", x2);
gotoxy(48,3);cprintf("2%c", x);
gotoxy(28,9);cprintf("J%c", x);
gotoxy(48,13);cprintf("K%c", x);
gotoxy(28,5);cprintf("8%c", x);
gotoxy(28,15);cprintf("3%c", x);
gotoxy(38,5);cprintf("5%c", x);
textcolor(4);
x=3;
gotoxy(48,9);cprintf("K%c", x);
gotoxy(48,5);cprintf("3%c", x);
gotoxy(28,11);cprintf("Q%c", x);
gotoxy(48,15);cprintf("6%c", x);
gotoxy(28,7);cprintf("J%c", x);
gotoxy(38,11);cprintf("9%c", x);
back9:
col3=getch();
if(col3=='1')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(8);
gotoxy(46,13);cprintf("J%c", x);
}
else if(col3=='2')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("7%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else goto back9;
}
else if(col2=='r' || col2=='R')
goto refresh;
else goto back6;
}
else if(col=='3')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=3;
gotoxy(28,3);cprintf("K%c", x);
gotoxy(48,3);cprintf("3%c", x);
gotoxy(28,5);cprintf("Q%c", x);
gotoxy(38,5);cprintf("6%c", x);
gotoxy(48,5);cprintf("J%c", x);
gotoxy(28,7);cprintf("9%c", x);
textcolor(4);
x=4;
gotoxy(28,15);cprintf("7%c", x);
gotoxy(38,7);cprintf("2%c", x);
gotoxy(48,7);cprintf("9%c", x);
gotoxy(38,9);cprintf("J%c", x);
gotoxy(48,9);cprintf("Q%c", x);
gotoxy(28,11);cprintf("5%c", x);
gotoxy(38,11);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(28,9);cprintf("A%c", x2);
gotoxy(38,3);cprintf("4%c", x2);
gotoxy(48,11);cprintf("2%c", x);
gotoxy(28,13);cprintf("J%c", x);
gotoxy(38,13);cprintf("K%c", x);
gotoxy(48,13);cprintf("8%c", x);
gotoxy(38,15);cprintf("3%c", x);
gotoxy(48,15);cprintf("5%c", x);
back10:
col2=getch();
if(col2=='1')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=3;
gotoxy(38,7);cprintf("K%c", x);
gotoxy(28,3);cprintf("3%c", x);
gotoxy(48,7);cprintf("Q%c", x);
gotoxy(28,13);cprintf("6%c", x);
gotoxy(38,3);cprintf("J%c", x);
gotoxy(28,9);cprintf("9%c", x);
textcolor(4);
x=4;
gotoxy(38,11);cprintf("7%c", x);
gotoxy(38,13);cprintf("2%c", x);
gotoxy(48,3);cprintf("9%c", x);
gotoxy(48,13);cprintf("J%c", x);
gotoxy(28,5);cprintf("Q%c", x);
gotoxy(48,9);cprintf("5%c", x);
gotoxy(28,15);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(38,9);cprintf("A%c", x2);
gotoxy(48,11);cprintf("4%c", x2);
gotoxy(38,5);cprintf("2%c", x);
gotoxy(28,11);cprintf("J%c", x);
gotoxy(38,15);cprintf("K%c", x);
gotoxy(48,5);cprintf("8%c", x);
gotoxy(48,15);cprintf("3%c", x);
gotoxy(28,7);cprintf("5%c", x);
back11:
col3=getch();
if(col3=='2')
{
clrscr();
x=5;
textcolor(15);
gotoxy(31,13);cprintf("Your card is an");
gotoxy(49,13);cprintf("!");
textcolor(8);
gotoxy(47,13);cprintf("A%c", x2);
}
else if(col3=='3')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("5%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else goto back11;
}
else if(col2=='2')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=3;
gotoxy(48,11);cprintf("K%c", x);
gotoxy(28,3);cprintf("3%c", x);
gotoxy(28,13);cprintf("Q%c", x);
gotoxy(48,7);cprintf("6%c", x);
gotoxy(38,3);cprintf("J%c", x);
gotoxy(38,13);cprintf("9%c", x);
textcolor(4);
x=4;
gotoxy(48,15);cprintf("7%c", x);
gotoxy(28,9);cprintf("2%c", x);
gotoxy(48,3);cprintf("9%c", x);
gotoxy(38,9);cprintf("J%c", x);
gotoxy(28,5);cprintf("Q%c", x);
gotoxy(28,15);cprintf("5%c", x);
gotoxy(48,9);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(48,13);cprintf("A%c", x2);
gotoxy(38,7);cprintf("4%c", x2);
gotoxy(38,5);cprintf("2%c", x);
gotoxy(38,15);cprintf("J%c", x);
gotoxy(28,11);cprintf("K%c", x);
gotoxy(48,5);cprintf("8%c", x);
gotoxy(38,11);cprintf("3%c", x);
gotoxy(28,7);cprintf("5%c", x);
back12:
col3=getch();
if(col3=='1')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("2%c", x);
}
else if(col3=='2')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("J%c", x);
}
else if(col3=='3')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("6%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else
goto back12;
}
else if(col2=='3')
{
textcolor(8);
gotoxy(33,23);cprintf("shuffling cards...");
sleep(2);
textcolor(15);
gotoxy(35,20);cprintf("Where is it?");
gotoxy(33,23);cprintf(" ");
textcolor(4);
x=3;
gotoxy(48,11);cprintf("K%c", x);
gotoxy(38,7);cprintf("3%c", x);
gotoxy(28,13);cprintf("Q%c", x);
gotoxy(38,3);cprintf("6%c", x);
gotoxy(48,7);cprintf("J%c", x);
gotoxy(38,13);cprintf("9%c", x);
textcolor(4);
x=4;
gotoxy(48,15);cprintf("7%c", x);
gotoxy(48,3);cprintf("2%c", x);
gotoxy(28,9);cprintf("9%c", x);
gotoxy(28,5);cprintf("J%c", x);
gotoxy(38,9);cprintf("Q%c", x);
gotoxy(28,15);cprintf("5%c", x);
gotoxy(38,5);cprintf("6%c", x);
textcolor(8);
x=5;
gotoxy(48,13);cprintf("A%c", x2);
gotoxy(28,3);cprintf("4%c", x2);
gotoxy(48,9);cprintf("2%c", x);
gotoxy(38,15);cprintf("J%c", x);
gotoxy(48,5);cprintf("K%c", x);
gotoxy(28,11);cprintf("8%c", x);
gotoxy(28,7);cprintf("3%c", x);
gotoxy(38,11);cprintf("5%c", x);
back13:
col3=getch();
if(col3=='1')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("9%c", x);
}
else if(col3=='2')
{
clrscr();
x=4;
textcolor(15);
gotoxy(31,13);cprintf("Your card is a");
gotoxy(48,13);cprintf("!");
textcolor(4);
gotoxy(46,13);cprintf("Q%c", x);
}
else if(col3=='r' || col3=='R')
goto refresh;
else
goto back13;
}
else if(col2=='r' || col2=='R')
goto refresh;
else
goto back10;
}
else if(col=='r' || col=='R')
goto refresh;
else
goto back;
sleep(2);
clrscr();
textcolor(4);
gotoxy(37,13);cprintf("THE END!");
}
else if(cho=='c' || cho=='C')
{
clrscr();
textcolor(8);
gotoxy(1,5);cprintf(" nspired by: afael artin's magic");
gotoxy(1,25);cprintf(" ress any key to exit");
textcolor(15);
gotoxy(1,1);cprintf("P");
gotoxy(13,1);cprintf("E");
gotoxy(20,1);cprintf("L");
gotoxy(1,3);cprintf("S");
gotoxy(20,3);cprintf("J");
gotoxy(25,3);cprintf("J");
gotoxy(1,5);cprintf("I");
gotoxy(14,5);cprintf("R");
gotoxy(21,5);cprintf("M");
gotoxy(1,25);cprintf("P");
gotoxy(22,25);cprintf("...");
getch();
goto intro;
}
else
goto intro;
return 0;
} </pre>
</div>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0tag:blogger.com,1999:blog-8848106751037611835.post-2741641874718828332012-09-13T21:20:00.000-07:002012-09-13T21:20:15.123-07:00C++ Program to convert any numeric entry into Words<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<span style="font-size: large;">C++ Program to convert any numeric entry into Words</span></blockquote><pre class="brush: plain">
<br />
#include <conio.h><br />#include <stdio.h><br />#include <stdlib.h><br />#include <string.h><br />#include <iostream.h><br /><br /><br />char * itoenglish(long n, int st);<br />void doit(long n, int st);<br /><br /><br />/*GETS THE NUMBER THAT IS TO BE CHANGED TO NUMBERS*/<br />void main()<br />{<br /> long num = 0;<br /> clrscr();<br /><br /> while( num >= 0 )<br /> {<br /> cout<<"Enter any number ( a negative number to quit )"<<endl;<br /> cin>>num;<br /> doit( num, 0 );<br /> };<br />}<br /><br /><br />/*TURNS THE DIGIT TO WORDS AND ADDS THE VALUE TO IT SUCH AS HUNDRED, THOUSAND*/<br />void doit(long n, int st)<br />{<br /> long z, showed;<br /> char str[100], out[100];<br /><br /> if (n != 0)<br /> {<br /> strcpy(out, "");<br /> showed = 0;<br /><br /><br /> if ((n / 1000) != 0)<br /> {<br /> z = n / 1000;<br /> n = n - z * 1000;<br /> sprintf(str, "%s thousand ", itoenglish(z, 0));<br /> strcat(out, str);<br /><br /> showed = 1000;<br /> }<br /><br /> if ((n / 100) != 0)<br /> {<br /> z = n / 100;<br /> n = n - z * 100;<br /> sprintf(str, "%s hundred ", itoenglish(z, 0));<br /> strcat(out, str);<br /><br /> showed = 100;<br /> }<br /><br /> if (n != 0)<br /> {<br /> z = n;<br /> if (showed == 100) strcat(out, "and");<br /> sprintf(str, "%s", itoenglish(z, st));<br /> strcat(out, str);<br /><br /> showed = 10;<br /> }<br /><br /> printf("%s", out);<br /> }<br /> else if ( n == 0 )<br /> printf("zero");<br /><br />printf("\n");<br />}<br /><br /><br />/*CHANGES THE DIGITS TO WORDS*/<br />char * itoenglish(long n, int st)<br />{<br /> char str[100];<br /> char th[2][3];<br /><br /> strcpy(th[0], "");<br /> strcpy(th[1], "TH");<br /><br /> if (n == 0)<br /> strcpy(str, th[st]);<br /><br /> else if (n == 1)<br /> {<br /> if (st == 0)<br /> strcpy(str, " one");<br /> }<br /><br /> else if (n == 2)<br /> {<br /> if (st == 0)<br /> strcpy(str, " two");<br /> }<br /><br /> else if (n == 3)<br /> {<br /> if (st == 0)<br /> strcpy(str, " three");<br /> }<br /><br /> else if (n == 4)<br /> sprintf(str, " four%s", th[st]);<br /><br /> else if (n == 5)<br /> {<br /> if (st == 0)<br /> strcpy(str, " five");<br /> }<br /><br /> else if (n == 6)<br /> sprintf(str, " six%s", th[st]);<br /><br /> else if (n == 7)<br /> sprintf(str, " seven%s", th[st]);<br /><br /> else if (n == 8)<br /> sprintf(str, " eight%s", th[st]);<br /><br /> else if (n == 9)<br /> sprintf(str, " nine%s", th[st]);<br /><br /> else if (n == 10)<br /> sprintf(str, " ten%s", th[st]);<br /><br /> else if (n == 11)<br /> sprintf(str, " eleven%s", th[st]);<br /><br /> else if (n == 12)<br /> sprintf(str, " twelve%s", th[st]);<br /><br /> else if (n == 13)<br /> sprintf(str, " thirteen%s", th[st]);<br /><br /> else if (n == 14)<br /> sprintf(str, " fourteen%s", th[st]);<br /><br /> else if (n == 15)<br /> sprintf(str, " fifteen%s", th[st]);<br /><br /> else if (n >= 16 && n <= 17)<br /> sprintf(str, " %steen%s", itoenglish(n - 10, 0), th[st]);<br /><br /> else if (n == 18)<br /> sprintf(str, " eighteen%s", th[st]);<br /><br /> else if (n == 19)<br /> sprintf(str, " nineteen%s", th[st]);<br /><br /> else if (n >= 20 && n <= 29)<br /> sprintf(str, " twenty%s", itoenglish(n - 20, st));<br /><br /> else if (n >= 30 && n <= 39)<br /> sprintf(str, " thirty%s", itoenglish(n - 30, st));<br /><br /> else if (n >= 40 && n <= 49)<br /> sprintf(str, " fourty%s", itoenglish(n - 40, st));<br /><br /> else if (n >= 50 && n <= 59)<br /> sprintf(str, " fifty%s", itoenglish(n - 50, st));<br /><br /> else if (n >= 60 && n <= 79)<br /> sprintf(str, " %sty%s", itoenglish(n / 10, 0),<br /><br /> itoenglish(n - (n / 10) * 10, st));<br /><br /> else if (n >= 80 && n <= 89)<br /> sprintf(str, " eighty%s", itoenglish(n - 80, st));<br /><br /> else if (n >= 90 && n <= 99)<br /> sprintf(str, " %sty%s", itoenglish(n / 10, 0),<br /><br /> itoenglish(n - (n / 10) * 10, st));<br /><br /> else<br /> strcpy(str, "");<br /><br /> if (strstr(str, "tTH") != NULL)<br /> strcpy(strstr(str, "tTH"), "TH");<br /><br />return(strdup(str));<br />} </div></pre>
adminhttp://www.blogger.com/profile/16691766495993632568noreply@blogger.com0