On 5:50:50 am 09/11/06 hong pham <[EMAIL PROTECTED]> wrote:
>
>
> &#32;        Stay in the know. Pulse on the new Yahoo.com.  Check it
 out.

Gu+?i la.i du`m Hong Pham

Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
mã nguồn của mình:
#include "stdio.h"

int main()
{
   char str[80];
     printf("Enter some words: ");
     scanf("%s", str);
     printf("The first word you entered is : %s\n", str );
 
     printf("Enter some words: ");
     scanf("%s", str);
     printf("The first word you entered is : %s\n", str );

   return 0;
}
và đây là kết quả mà mình mong đợi:
"Enter some words:hello word
 The first word you entered is:hello
 Enter some words:who are u?
 The first word you entered is:who"
nhưng kết quả mà mình thu được lại là:
"Enter some words: hello word
 The first word you entered is : hello
 Enter some words: The first word you entered is : word"
Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
cám ơn!!!


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users

Trả lời cho