如何使用命令行参数C编写C程序来检查元音或辅音 [英] How to write C program to check vowel or consonant using use command line arguments C

查看:84
本文介绍了如何使用命令行参数C编写C程序来检查元音或辅音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C program to check vowel or consonant using command line arguments





我尝试了什么:





What I have tried:

#include <stdio.h>
 
int main()
{
  char ch;
 
  printf("Input a character\n");
  scanf("%c", &ch);
 
  if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' &&ch <= 'Z')) {
    if (ch=='a' || ch=='A' || ch=='e' || ch=='E' || ch=='i' || ch=='I' || ch=='o' || ch=='O' || ch== 'u' || ch=='U')
      printf("%c is a vowel.\n", ch);
    else
      printf("%c is a consonant.\n", ch);
  }
  else
    printf("%c is neither a vowel nor a consonant.\n", ch);
 
  return 0;
}

推荐答案

使用C编程处理命令行参数是每个C编程手册和在线教程的一部分。



快速网络研究将为您提供大量示例。我为你选了一些:

小C入门/ C命令行参数 - 维基教科书,自由的书开放世界 [ ^ ]

GNU C Library:Program Arguments [ ^ ]

如何解析命令行参数。 - C ++文章 [ ^ ]
Handling command line arguments with C programming is part of each C programming book and online tutorial.

A quick web research will give you a lot of examples. I picked some for you:
A Little C Primer/C Command Line Arguments - Wikibooks, open books for an open world[^]
The GNU C Library: Program Arguments[^]
How to parse command line parameters. - C++ Articles[^]


这篇关于如何使用命令行参数C编写C程序来检查元音或辅音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆