![]() ![]() | ![]() |
|
ปรับปรุง : 2564-07-13 (ปรับแฟ้ม) |
| datatype | TurboC | Programming |
// array char, pointer of string, 2 dimension<br>นับความยาวของแต่ละ string พร้อมแยกตัวอักษรทีละตัว
/* http://www.thaiall.com/tc */
#include <iostream.h>
#include <string.h>
#include <conio.h>
void main()
{
clrscr();
int i,j,l;
char *x[5]={"abcd","ef","ghi","jklmn","o"};
for (i=0;i<5;i++) {
l = strlen(x[i]);
cout << l << " : ";
for (j=0;j<l;j++) {
cout << x[i][j] << " - ";
}
cout << "\n";
}
getch();
}
|
|
| "ไม่เริ่มต้นในวันนี้ จะไม่มีทางสำเร็จในวันพรุ่ง" โดย โยฮัน ว็อล์ฟกัง ฟ็อน เกอเทอ |