| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 873 人关注过本帖
标题:统计字符数量为什么总是多一个
取消只看楼主 加入收藏
dtxwz
Rank: 2
等 级:论坛游民
帖 子:79
专家分:45
注 册:2011-9-18
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:0 
统计字符数量为什么总是多一个
// 3.cpp: 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<array>
#include<ctime>
#include<fstream>
#include<cstdlib>
#include<cctype>
using namespace std;
const int strsize = 20;
struct intribute
{
    string name;
    double money;
};
int main()
{
    char ch;
    int count = 0;
    ifstream inFile;
    inFile.open("name.txt");
    while (inFile.good())
    {        

        inFile >> ch;        
        if (isalpha(ch))
            count++;

    }
    cout << count << endl;
    return 0;
}

name.txt
abcde
搜索更多相关主题的帖子: 统计 include name int count 
2018-08-02 22:37
快速回复:统计字符数量为什么总是多一个
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014977 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved