标题:C++求助帮忙修改程序··········
只看楼主
夏臻
Rank: 1
来 自:甘肃
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-5-2
 问题点数:0 回复次数:0 
C++求助帮忙修改程序··········
// qimo1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include"fstream"
#include"string"
#include
#include"iostream"
#include"vector"
#include"stdio.h"
using namespace std;
#include

//vector<> ciping(string string2);
struct Test
{
    int num;
    string string3;
};
 static int cmp(Test w1,Test w2);
void main(int argc, char* argv[])
{
    int i=1;
    int pd=1;
    string string1;
    Test m_test;
        vector::iterator iter;
        vector m_vector;
    vector m_vector1;
 ifstream icin("D:\\7.txt",ios::in);
 ofstream outfile("D:\\1.txt",ios::out);
  while(icin)

  {
      pd=1;
          icin>>string1;
    /*    if(i==1)
        {
          m_test.string3=string1;
          m_test.num=1;
          m_vector.push_back(m_test);
          i++;
        }*/
    //    else
    //{
            for(iter=m_vector.begin();iter!=m_vector.end();iter++)
            {
                //pd=1;
                 m_test=*iter;
              
              if(m_test.string3==string1)
              {
                 //m_test.string3=string1;
                m_test.num++;
                m_test.string3=string1;
                m_vector.erase(iter);
            //    *iter=m_test;
                 m_vector.push_back(m_test);
                 
                  pd=2;
                  break;

              }
            }
            if(pd==1)
            {
                m_test.string3=string1;
                 m_test.num=1;
                 m_vector.push_back(m_test);
            }
            
        


    //    }
        
        //m_vector1=ciping(string1);        
  }
  stable_sort(m_vector.begin(),m_vector.end(),cmp);
    for(iter=m_vector.begin();iter!=m_vector.end();iter++)
    {
      m_test=*iter;
      cout<::iterator iter;
//        vector m_vector;
///        m_test.string3=string2;
    //    m_test.num=1;
//        m_vector.push_back(m_test);
//        return(m_vector);

亲帮帮忙啊,明天交,换种做法
搜索更多相关主题的帖子: include void 
2012-06-20 00:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-371913-1-1.html




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

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