001
#include<iostream>
#include<cassert>
using namespace std;
int yourMoney = 60000;
void getMoney(int mount)
{
if(mount < 0)
{
cout<<"取钱的数量不能小于0!"<<endl
<<"文件:"<<__FILE__<<endl
<<"行:"<<__LINE__<<endl
<<"日期:"<<__DATE__<<endl
<<"时间:"<<__TIME__<<endl;
return ;
}
yourMoney -= mount;
}
int add(int x,int y)
{
return x + y;
}
int main()
{
#ifndef NDEBUG
cout<<"start main..."<<endl;
#endif
getMoney(1000);
int result;
result = add(1,2);
assert(result==3);
#ifndef NDEBUG
cout<<"end."<<endl;
#endif
return 0;
}
002
#include<iostream>
using namespace std;
int main()
{
string currWord,preWord;
cout<<"enter some words:(ctrl + z to end)"<<endl;
while(cin>>currWord)
{
cout<<currWord<<endl;
if(!isupper(currWord[0]))
continue;
if(currWord == preWord)
break;
else
preWord = currWord;
}
if(currWord == preWord && !currWord.empty())
cout<<"the repeated word:"<<currWord<<endl;
else
cout<<"没有重复的!"<<endl;
return 0;
}