當前位置:文思屋>學習教育>考研>

微軟實習生筆試題

文思屋 人氣:2.79W

// : 定義控制檯應用程式的入口點。
//

微軟實習生筆試題

#include "stdafx.h"

#define BUFMAX 100

//Find frequency of words of in
void Find (string &filenameA, string &filenameB)
{
 string tempA, tempB;
 char chA[BUFMAX], chB[BUFMAX];
 int cnt = 0, match = 0;
 
 if ( (th()==0) || (th()==0) )
 {
  cout << "Invalid input filename!" << endl;
  return ;
 }
 
 ifstream infileA ( filenameA.c_str() );
 ifstream infileB ( filenameB.c_str() );

 if ( () || () )
 {
  cout << "Cannot open input files!" << endl;
  return ;
 }

 while ( getline(infileB, tempB) )
 {
  memcpy ( chB, tempB.c_str(), th()+1 );
  cnt = 0;

  g (0, ios::beg);

  while ( !() )
  {
   infileA >> tempA;
  
   if (tempA == tempB)
    cnt++;
   else
   {
    memcpy (chA, tempA.c_str(), th()+1);