私がDev-C++で次のコードをコンパイルすると、プログラムがうまく動作します。
Xcode 3.2.6でコンパイルすると、スクリーンショットのように見えます。
Xcodeでさまざまなコンパイラ設定を試みましたが、動作は変わりません。
これに関するアイデアですか?異なる動作xcodeとDev-C++
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char artist[30];
char album[30];
int tracks;
char albumsingle;
float price;
printf("Please enter CD informations below. \n \n");
printf("enter cd artist: ");
scanf("%[^\n]", artist);
printf("enter cd title: ");
fflush(stdin);
scanf("%[^\n]", album);
printf("enter no. of tracks: ");
fflush(stdin);
scanf("%d", &tracks);
printf("enter a for album s for single: ");
fflush(stdin);
scanf("%c", &albumsingle);
printf("enter price: ");
fflush(stdin);
scanf("%f", &price);
printf("\n\n\nartist: %s\n", artist);
printf("album: %s\n", album);
printf("track no.: %d\n", tracks);
if (albumsingle == 'a'){
printf("cd type: album\n");
} else {
printf("cd type: single\n");
}
printf("price: %.2f EUR\n\n", price);
system("PAUSE");
return 0;
}
どのスクリーンショットを使用しますか?スクリーンショットを追加するのではなく、質問にエラーメッセージを追加するか、予想される出力と実際の出力を追加するだけです。 –