普通电报和加急电报计费问题

编写程序,计算电报费用。电报计费规则:若为普通电报,每个字0.75元,如不足10个字,按10个字计算;若为加急电报,则加上一个字,再加倍收费。键盘输入电报文字数。


#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a;//'j'为加急‘b’ 为不加急 
    double b;
    cin>>a>>b;
    if(a=='b')
    {
        if(b<=10)
        {
            cout<<10*0.75;
        }
        else cout<<b*0.75;
    }
    else if(a=='j')
    {
        if(b<=9)
        {
            cout<<10*1.5;
        }
        else cout<<(b+1)*1.5;
    }
}

大致是这样吧

#include<stdio.h>
#include<string.h>

void main(){
    int f,n;
    printf("选择普通电报输入1,加急电报输入2:");
    scanf("%d",&f);
    printf("输入输入电报文字数:");
    scanf("%d",&n);
    if (n<10)
        n = 10;
    if (n<=10 || f==1)
    {
        printf("电报费用:%.2f:",n*0.75);
    }
    else
    {
        printf("电报费用:%.2f:",10*0.75+(n-10)*0.75*2);
    }
}


那怎么知道是普通电报还是加急电报呢?