微软实习生笔试题
// test.cpp : 定义控制台应用程序的入口点,
微软实习生笔试题
。//
#include "stdafx.h"
#define BUFMAX 100
//Find frequency of words of file-B.txt in file-A.txt
void Find (string &filenameA, string &filenameB)
{
string tempA, tempB;
char chA[BUFMAX], chB[BUFMAX];
int cnt = 0, match = 0;
if ( (filenameA.length()==0) || (filenameB.length()==0) )
{
cout << "Invalid input filename!" << endl;
return ;
}
ifstream infileA ( filenameA.c_str() );
ifstream infileB ( filenameB.c_str() );
if ( infileA.fail() || infileB.fail() )
{
cout << "Cannot open input files!" << endl;
return ;
}
while ( getline(infileB, tempB) )
{
memcpy ( chB, tempB.c_str(), tempB.length()+1 );
cnt = 0;
infileA.seekg (0, ios::beg);
while ( !infileA.eof() )
{
infileA >> tempA;
if (tempA == tempB)
cnt++;
else
{
memcpy (chA, tempA.c_str(), tempA.length()+1);
【微软实习生笔试题】相关文章:
1.微软笔经
2.微软笔经小结
3.微软笔试题
5.微软笔试题目
6.微软智力笔试题