Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode input問題 #12

Open
leo0049l opened this issue May 31, 2016 · 1 comment
Open

Encode input問題 #12

leo0049l opened this issue May 31, 2016 · 1 comment
Labels

Comments

@leo0049l
Copy link

想請問一下如果我輸入input後
都一定要按enter才能把input丟進去
但這樣就會多讀到一個enter (不屬於input裡面的)
那這樣要把那個enter給扣掉
還是不用處理

@leo0049l leo0049l changed the title Decode input問題 Encode input問題 May 31, 2016
@Yi-Tseng
Copy link
Contributor

我們會 pipe 一個文件(可能有多行)到你的程式中,換行字元(\n)也是一個 ascii 字元,需要被編碼

結束字元透過 EOF 判定,可以參考下方程式:

#include<stdio.h>
int main() {
    char c;
    while(scanf("%c", &c) != EOF) {
        printf("%c", c);
    }
    return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants