關於陣列的一個小問題 如果我想要這樣的結果
Enter numbers of points: 5
Enter points: -1 2 3 6 -3 -5 -1 0 10 -24
The points are: (-1.00, 2.00), (3.00, 6.00), (-3.00, -5.00), (-1.00, 0.00),
(10.00, -24.00)
我目前是想用二維陣列把數字存起來 像這樣
printf("Enter numbers of points: ");
scanf("%d", &n);
for(i=0; i<n; i++){
for(j=0; j<2; j++) scanf(" %d", &num[i][j])
for(i=0; i<n; i++){
for(j=0; j<2; j++) printf("%lf", num[i][j]); }
但是這樣數字只能一個一個輸入 如果要像題目一次輸入的話 要怎麼改比較好呢
另外想問像這樣類似的問題 如果輸入n之後才能知道需要的陣列大小
宣告的時候要怎麼宣告呢 我目前是把大小設成一個相對大的數字 但我想應該有更好的方法 謝謝