注册 登录
编程论坛 C++教室

新手问题,请大虾们指点指点!!

wangzonggui 发布于 2007-03-21 21:40, 360 次点击

while后为什么是1
toupper是什么意思?
#include<iostream>
#include<iostream>
using namespace std;

int main()
{
char flag;
while(1)
{
cout<<"(Yes or No):";
cin>>flag;
if(toupper(flag)=='Y'
{cout.....

2 回复
#2
song42007-03-21 21:52
无限循环
#3
yuyunliuhen2007-03-21 22:19
以下是引用wangzonggui在2007-3-21 21:40:28的发言:


toupper是什么意思?


toupper

原型:extern int toupper(int c);

用法:#include <ctype.h>

功能:将字符c转换为大写英文字母

说明:如果c为小写英文字母,则返回对应的大写字母;否则返回原来的值。

举例:
#include <iostream>
#include <ctype.h>
using namespace std;
main()
{
char *s="Hello, World!";
int i;
cout<<s;
for(i=0;i<strlen(s);i++)
{
putchar(toupper(s[i]));
}

getchar();
return 0;
}

1