办法很多,三维字符数组,指针字符数组都可以,分别保存字符串到数组元素,最后以%s输出即可。
我来写个最简单的
#include "stdafx.h"
#include "stdlib.h"
#include "string.h"
void explain_NS(char * str)
{
char tmp_ca[30] = "";
if(str[0] == 'N')
strcpy(tmp_ca,"北纬");
else
strcpy(tmp_ca,"南纬");
char *p = tmp_ca;
while(*p) p++;
strncpy(p, str+1, 2);
p += 2;
*p = 176;
p ++;
strncpy(p,str+3,2);
p += 2;