tag:blogger.com,1999:blog-79685869816949124952024-03-08T04:52:35.892-08:00OOP344Mercedeshttp://www.blogger.com/profile/00531020507622119757noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-7968586981694912495.post-48117807184588937212009-09-15T09:55:00.000-07:002009-09-17T17:56:33.440-07:00Challenge: write this function without using any library functions; void GetInt(char *strint, int val);<br />this function gets an integer value and converts it to a string ("strint")<br /><br />void GetInt(char *strint, int val){<br /><br /> int input;<br /> int cnt;<br /> <br /> input = 0;<br /> cnt = 0;<br /><br /> input = val;<br /><br /> /* check the input value */<br /> if(input >= 0){<br /> do{<br /> /* input int value to string */<br /> /* 48 means 0 in ascii code */<br /> strint[cnt] = (input % 10) + 48; <br /> input = input / 10;<br /> cnt++;<br /><br /> }while(input);<br /> strint[cnt] = '\0';<br /> }<br /> else{<br /> strint[cnt++] = '-';<br /> strint[cnt] = '\0';<br /> }<br />}Mercedeshttp://www.blogger.com/profile/00531020507622119757noreply@blogger.com0