Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
N が不明な配列の行にある N 個の数値をすべて読み取る必要があります。改行が検出されると、別の配列の次の X 番号を読み取ります。×も不明。
入力の形式は次のとおりです。
1 2 3 4 5 .. ~ N (配列 A に格納)
1 2 3 4 .. から X (配列 B に格納)。
この場合の入力をどのように取るのですか?
あなたが試すことができます
while ( scanf(" %d%c", &num, &ch) == 2 ) { if ( ch =='\n') break; // to do :: store or whatever you want }
改行を取得するまで読み取ります。