练习2014081901

/********************************************************************
@file     Main_practise.cpp
@date     2014-8-19
@author   Tiger
@brief    範例:複製字串
@details  無論電腦再怎麼強,還是得逐字複製。
********************************************************************/
#include <iostream>

const int SIZE = 15;

void copy(char* s, char* t);

int main(int argc, const char* argv[])
{
	char s[SIZE] = "incremental";
	char t[SIZE] = {0};

	copy(s, t);
	std::cout << s << std::endl << t << std::endl;

	system("pause");
	return 0;
}

void copy(char* s, char* t)
{
	int i = 0;
	for (; s[i]!=‘\0‘; ++i)
	{
		t[i] = s[i];
	}
	t[i] = ‘\0‘;
}

练习2014081901

时间: 2024-08-25 11:35:24

练习2014081901的相关文章