引用 | 編輯
akole
2007-12-04 21:13 |
1樓
▲ ▼ |
void main(void)
{ int a; <===a宣告為int while((a=getchar()) != EOF) <====結果擷取自元?????? my_puts(a); } void my_puts() <===丟到不用回傳的函式,也沒傳入,也沒接收 { int c; 又一個宣告C while((c=getchar()) != EOF) <===哪時候擷取到阿 putch(c); <====丟進去的又是哪個,好怪喔 } 是我觀念錯了,還是真的是要這樣子寫阿~~~~~~~~~~~~~????? x0 |
引用 | 編輯
isaacfong
2007-12-17 16:16 |
2樓
▲ |
自解........
#include<stdio.h> #include<string.h> char my_puts( char * input ) { int i ; for( i=0; input != '\0' ; i++ ) putchar( input ) ; } int main( void ) { char input[100] ; puts("Enter a staring : "); fgets( input , sizeof(input) , stdin ); my_puts( input ); return 0; } x0 |