C编程中的isupper()函数检查给定字符是否为大写。isupper()函数是在ctype中定义的。h头文件。
null
语法:
int isupper ( int x );
例如:
Input: AOutput: Entered character is uppercase characterInput: aOutput: Entered character is not uppercase characterInput: 1Output: Entered character is not uppercase character
C
// C program to demonstrate // isupper() function #include <ctype.h> #include <stdio.h> int main() { char ch = 'A' ; // checking uppercase if ( isupper (ch)) printf ( "Entered character is uppercase character" ); else printf ( "Entered character is not uppercase character" ); } |
输出:
Entered character is uppercase character
申请: C语言中的isupper()函数用于计算给定句子中出现的大写字母总数。 例子:
Input: GEEKSFORGEEKSOutput: Number of upper case present in the sentence is : 13Input: GeeksFORGeeksOutput: Number of upper case present in the sentence is : 5Input: geeksforgeeksOutput: Number of upper case present in the sentence is : 0
C
// C program to demonstrate // isupper() function #include <ctype.h> #include <stdio.h> // called function int ttl_upper( int i, int counter) { char ch; char a[50] = "GeeksForGeeks" ; ch = a[0]; // counting of upper case while (ch != ' ' ) { ch = a[i]; if ( isupper (ch)) counter++; i++; } // returning total number of upper case present in sentence return (counter); } int main() { int i = 0; int counter = 0; // calling function counter = ttl_upper(i, counter); printf ( "Number of upper case present in the sentence is : %d" , counter); return 0; } |
输出:
Number of upper case present in the sentence is : 3
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END