c++程式
我們老師出了個題目
要我們把下面的程式
每一行都要加註解
想了很久
決定求助各位c++達人
有誰可以幫我啊
#include <cstdlib>
#include <iostream>
using namespace std;
void sd (char a[],char b[]);
int strlent(char []);
int main(int argc, char *argv[])
{
int strlent(char[]);
char a[40]="Kurosaki Ichigo";
char b[40]="Ban Kai";
cout << a << "["<<strlent(a)<< "]"<< endl;
cout << b << "["<<strlent(b)<<"]" << endl;
//cout << "a+b=" << sd(a,b) <<endl;
sd(a,b);
system("PAUSE");
return EXIT_SUCCESS;
}
int strlent(char a[])
{
int strlent(char a[]),i=1;
do{
i++;
}while(a!='\0');
return i;
}
void sd (char a[],char b[])
{
int i=0;
do{
i++;
}while(a!='\0');
char c[40];
for (int j=0;j<40;j++)
{
c[j]=a[j];
}
for ( int j=i;j<40;j++)
{
c[j]=b[j-i];
}
cout << "a+b=" << c <<endl;
}