0

Visual Studio 2012 Express で C の小さな銀行プログラムをコンパイルしようとしています。ほとんどすべての変数に対してこのエラー「宣言されていない識別子」が表示され、これも「構文エラー:「;」がありません」正しい構文を教えてください。よろしくお願いします。

#include<stdio.h>
#include<conio.h>
int main()
{
printf("Welcome to skybank\n");
int deposit,withdraw,kbalance;
char option;
printf("Press 1 to deposit cash\n");
printf("Press 2 to Withdraw Cash\n");
printf("Press 3 to Know Your Balance\n");
scanf_s("%c",option);
int decash,wicash;
switch(option)
{
int balance;
printf("Enter your current Balance\n");
scanf_s("%d",&balance);
case 1:
    printf("Enter the amount you want to deposit\n");
    scanf_s("%d",&decash);
    printf("Thank You\n");
    printf("%d have been deposited in your account\n",decash);
    break;
case 2:
    printf("Enter the amount you want to withdraw\n");
    scanf_s("%d",&wicash);
    int wibal;
    wibal=balance-wicash;
    printf("Thank You\n");
    printf("%d have been withdrawed from your account\n",wicash);
    printf("Your balance is %d\n",wibal);
    break;
case 3:
    printf("Your balance is Rs.%d\n",balance);
    break;
default:
    printf("Invalid Input\n");
    break;
}
getchar();
}
4

5 に答える 5

1

ビジュアル c の変数の宣言のブロックの先頭で実行します。

例えば

int main()
{
    int deposit,withdraw,kbalance;
    char option;
    int decash,wicash
    int balance;
    int wibal;
...
于 2013-06-16T15:06:03.567 に答える