首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

帮小弟我看看这个程序

2012-03-26 
帮我看看这个程序#includestdafx.h #includewindows.h#includeiostream#includefstreamusingnames

帮我看看这个程序
#include   "stdafx.h "


#include   <windows.h>
#include   <iostream>
#include   <fstream>
using   namespace   std;
int   _tmain(int   argc,   _TCHAR*   argv[])
{


    char   filename[MAX_PATH];
char   filename1[MAX_PATH];

cout   < <   "input   source   file   name   and   path: " < <   endl;
    cin   > >   filename;
    cout   < <   "destination   file   name   and   path: "   < <   endl;
    cin   > >   filename1;
ifstream   fin(filename);
char   ch;
int   count   =   0;
ofstream     fout(filename1);

while(fin.get(ch))
{      
if(ch   ==   ', ')
  count   =+   1;

        if(count   %   3   ==   0)
fout   < <   ch   ;
     
}

        cout   < <   count < <endl;

return   0;
}

为什么count   的值总是一?

[解决办法]
count =+ 1;

改为 count ++; 或者 count += 1;
[解决办法]
count =+ 1;//count += 1;

热点排行