#4592: __VB


Roce59427 (Yuki)


 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪

#4593: Re:VB


YogiBear (test)


 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。
#4594: Re:VB


YogiBear (test)


 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。



喔 改這樣好了

dim s as string
Open Cons for input as #1

do
    Line Input #1, s
       
    If trim(s) <> "" then
        print "hello, ";s
    end if
loop until eof(1)

測資裡面有空行,才會多輸出一行

加個判斷就不會了。

 

#4595: Re:VB


Roce59427 (Yuki)


 如果直接用範例的話 會顯示

您的輸出超過測資的輸出!!(line:2)
您額外輸出了: hello,

如果把空格去掉

dim s as string
Open Cons for input as #1
do
    Line Input #1, s
    print "hello,"; s
loop until eof(1)

 *** 第 1 點 (20%):WA (line:1)
您的答案為: hello,world
正確答案為: hello, world

*** 第 2 點 (80%):WA (line:1)
您的答案為: hello,C++
正確答案為: hello, C++

 

 

不太明白問題出在哪



他本來建議的範例是這樣

Dim s As String

Open CONS For Input As #1
Input #1, s
Do Until EOF(1)
    Print "hello, "; s
    Input #1, s
Loop

現在新的範例是我建議的

我要建議之前測試也 AC 的

怎突然不行了

有點納悶。



喔 改這樣好了

dim s as string
Open Cons for input as #1

do
    Line Input #1, s
       
    If trim(s) <> "" then
        print "hello, ";s
    end if
loop until eof(1)

測資裡面有空行,才會多輸出一行

加個判斷就不會了。

 

謝謝囉

我看了好久都看不出問題