```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 ``` ```#include #include #include #include int STRLEN(char s[]) { int dem = 0; while (s[dem] != '\0') { dem++; } return dem; } int ATOI(char *s) { // "1234" int tong = 0; int length = STRLEN(s); int Temp = length; // Xác định temp để biết phạm vi mình sẽ duyệt for (int i = 0; i < length; i++) { if (s[i] < '0' || s[i] > '9') // Không phãi là số { Temp = i; break; } } // Tính ra kết quã int Temp1 = Temp; for (int i = 0; i < Temp; i++) { tong +=(s[i] - 48) * pow(10.0, --Temp1); // đổi ký tự sang số rồi nhân cho 10 mũ ... } return tong; } double ATOF(char s[]) { char phannguyen[30]; char phanle[30]; int idx = 0; int length = STRLEN(s); bool Check = true; for(int i = 0; i < length; i++) { if(Check == true) { phannguyen[idx++] = s[i]; } else { phanle[idx++] = s[i]; } if(s[i] == '.') { Check = false; idx = 0; } } return ATOI(phannguyen) + ATOI(phanle) / pow(10.0, idx); } int main() { char str1[100]; printf("Nhap chuoi: "); //scanf("%s",str2); gets(str1); // phải dùng gets double y = ATOF(str1); printf("\nDoi chuoi %s sang so: %lf", str1, y); getch(); return 0; } ```
 ```1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ``` ```Line 17: error: conio.h: No such file or directory In function 'ATOI': Line 23: error: 'for' loop initial declaration used outside C99 mode Line 33: error: redefinition of 'i' Line 23: error: previous definition of 'i' was here Line 33: error: 'for' loop initial declaration used outside C99 mode In function 'ATOF': Line 46: error: 'bool' undeclared (first use in this function) Line 46: error: (Each undeclared identifier is reported only once Line 46: error: for each function it appears in.) Line 46: error: expected ';' before 'Check' Line 48: error: 'for' loop initial declaration used outside C99 mode Line 50: error: 'Check' undeclared (first use in this function) Line 50: error: 'true' undeclared (first use in this function) Line 60: error: 'false' undeclared (first use in this function) ```