當前位置:
首頁 >
while中的continue用法,getchar及putchar使用方法
發布時間:2023/12/14
32
豆豆
生活随笔
收集整理的這篇文章主要介紹了
while中的continue用法,getchar及putchar使用方法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
//int main()
//{
// int a = 0;
// while (a <= 9)
// {
// a++;
// if (a == 5)
// continue;//在while循環中,continue負責跳過本次循環continue后面的代碼
// printf("%d\n", a);
// }
// return 0;
//}
//int main()
//{
// int a = getchar();我認為getchar相當于讀取輸入字符的ASCII值
// printf("%c\n", a);這個c將ASCII值轉換為字符
// putchar(a); putchar將ASCII值轉換為字符并打印
// return 0;
//}
int main() //int main()
{ //{int ch = 0; //int ch=getchar();此時ch只能是輸入字符的ASCII值while ((ch=getchar()) != EOF) //while(ch!=EOF) 這個while循環會無限循環putchar(ch); // putchar(ch);return 0; //return 0;
} //}//
1
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> int main() {char password[20];printf("請輸入密碼:");scanf("%s", password);int a;while (a = getchar() != '\n')//清理\n之前的數據{;}printf("是否確認密碼Y/N:");int b = getchar();if (b = 'Y')printf("確認密碼");elseprintf("否認密碼");return 0; }?
總結
以上是生活随笔為你收集整理的while中的continue用法,getchar及putchar使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Tomcat发布项目时,浏览器地址栏图标
- 下一篇: 弹性云服务器的优势有哪些