📄 secondh.c
字号:
/* * File: secondh.c * --------------- * This file defines the function SecondHalf(str), * which returns the second half of its argument. */#include <stdio.h>#include "genlib.h"#include "strlib.h"#include "simpio.h"/* Function prototypes */string SecondHalf(string str);/* Main program */main(){ string str; printf("Enter a string: "); str = GetLine(); printf("The second half of \"%s\" is \"%s\"\n", str, SecondHalf(str));}/* * Function: SecondHalf * Usage: newstr = SecondHalf(str); * -------------------------------- * This function returns the second half of the string str. * If the string contains an odd number of characters, the * center character is included in the result. */string SecondHalf(string str){ int len; len = StringLength(str); return (SubString(str, len / 2, len - 1));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -