Thứ Hai, 1 tháng 2, 2016

bt8/b9

#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
#include&lt;malloc.h&gt;<br />
#include&lt;string.h&gt;<br />
<br />
void val(char st)<br />
{<br />
&nbsp;switch (st)<br />
&nbsp;{<br />
&nbsp; case '1': printf("one"); break;<br />
&nbsp; case '2': printf("two"); break;<br />
&nbsp; case '3': printf("three"); break;<br />
&nbsp; case '4': printf("four"); break;<br />
&nbsp; case '5': printf("five"); break;<br />
&nbsp; case '6': printf("six"); break;<br />
&nbsp; case '7': printf("seven"); break;<br />
&nbsp; case '8': printf("eight"); break;<br />
&nbsp; case '9': printf("nine"); break;<br />
&nbsp; case '0': printf("zero"); break;<br />
&nbsp;}<br />
}<br />
<br />
main()<br />
{<br />
&nbsp;char *s;<br />
&nbsp;int i=0;<br />
&nbsp;s=(char*)calloc(255,sizeof(char));<br />
<br />
&nbsp;printf("\t- Nhap vao chuoi so: "); gets(s);<br />
&nbsp;printf("\t=&gt; Dang kys tu tieng anh:\n\t");<br />
<br />
&nbsp;fflush(stdin);<br />
<br />
&nbsp;while (s[i]!='\0')<br />
&nbsp; {<br />
&nbsp; &nbsp;val(s[i]);<br />
&nbsp; &nbsp;printf(" ");<br />
&nbsp; &nbsp;i++;<br />
&nbsp; &nbsp;}<br />
<br />
&nbsp;getch();<br />
}<

0 nhận xét: