我的string参考

#include <iostream>
#include <conio.h>
#include <string>

using namespace std;

void main()
{

 string word;
 //while (cin>>word)
 //while(getline(cin,word))
 getline(cin,word);
 cout<<word<<endl;

 basic_string<char>::size_type i;
 i= word.size();
 cout<<i<<endl;

 for (string::size_type iy=0; iy!=word.size(); iy++)
 {
  if(ispunct(word[iy]))//标点
   cout<<word[iy]<<endl;
  //if(isalnum(word[iy]))//字母或数字
  // cout<<word[iy]<<endl;
  //isalpha() // 字母
  //iscntrl();// 控制字符
  //isdigit();//数字
  //isgraph();//不是空格,但可打印
  //islower();//小写字母
  //isupper();//大写字母
  //isprint();//可打印的字符
  //isspace();//空白符
  //isxdigit();//十六进制熟

  //tolower();;//if大写 返回小写
  //toupper();;//if小写 返回大写

 }


 word = "1234/n/0";
 i = word.size();
 cout<<word[0]<<" "<<word<<" "<<i<<endl;


 for (string::size_type ix=0; ix!=word.size(); ix++)
 {
  cout<<word[ix]<<endl;
 }
 cout<<word<<endl;


 getch();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值