日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

反转字符串中的元音字符_C程序消除字符串中的所有元音

發布時間:2023/12/1 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 反转字符串中的元音字符_C程序消除字符串中的所有元音 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

反轉字符串中的元音字符

Given a string and we have to eliminate/ remove all vowels from the string using C program.

給定一個字符串,我們必須使用C程序從字符串中消除/刪除所有元音。

To eliminate/remove the vowels

消除/刪除元音

  • We will traverse (reach) each elements by using a loop

    我們將使用循環遍歷(到達)每個元素

  • And, check the each element, if any element found as vowel, we will remove that shifting all other elements to the left

    并且,檢查每個元素,如果發現任何元素為元音,我們將刪除將所有其他元素向左移動的操作

  • Finally, we will print the string - that will be a string without the vowels

    最后,我們將打印字符串-這將是沒有元音的字符串

Example:

例:

Input:String is: "Hello World"Output:String after removing vowels: "Hll Wrld"

程序從C的字符串中消除所有元音 (Program to eliminate all vowels from the string in C)

.minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} .minHeight{min-height: 250px;}@media (min-width: 1025px){.minHeight{min-height: 90px;}} /* C program to eliminate all the vowels * from the entered string */ #include <stdio.h> #include <string.h>int main() {char string[50] = { 0 };int length = 0, i = 0, j = 0, k = 0, count = 0;printf("\nEnter the string : ");gets(string);length = strlen(string);count = length;for (j = 0; j < length;) {switch (string[j]) {case 'a':case 'A':case 'e':case 'E':case 'i':case 'I':case 'o':case 'O':case 'u':case 'U':for (k = j; k < count; k++) {string[k] = string[k + 1];//printf("\nstring : %s",string);}count--;break;default:j++;}}string[count] = '\0';printf("Final string is : %s", string);return 0; }

Output

輸出量

Enter the string : Hello World Final string is : Hll Wrld

翻譯自: https://www.includehelp.com/c-programs/eliminate-all-vowels-from-a-string.aspx

反轉字符串中的元音字符

總結

以上是生活随笔為你收集整理的反转字符串中的元音字符_C程序消除字符串中的所有元音的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。