📄 continue.cpp
字号:
//这个程序在本书所带软盘中,文件名为CONTINUE.CPP
//这个程序演示继续语句continue的应用。
#include <iostream.h>
#include <conio.h>
void main(void)
{
char text[] = "This is a test string. It contains two setances.";
char new_text[80];
int i, count = 0;
cout << "最初定义的文字为: " << text << endl << endl;
for (i = 0; text[i] != '\0'; i++)
{
//过滤所有元音字符
if (text[i] == 'i' || text[i] == 'e' || text[i] == 'o' || text[i] == 'u')
continue;
new_text[count] = text[i]; //拷贝所有其他字符
count++;
}
new_text[count] = '\0'; //加入字符串结束符
cout << "修改后的文字为: " << new_text << endl;
}
/*这个程序运行后将输出如下结果:
最初定义的文字为: This is a test string. It contains two setances.
修改后的文字为: Ths s a tst strng. It cntans tw stancs.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -