[解答] 計程上機考Q3

看板NTUBIME96-HW作者 (我 累 了)時間22年前 (2003/12/08 00:39), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
#include <stdafx.h> #include <iostream> using std::cout; using std::cin; using std::endl; void change( char [] ); int main() { char input[80]; cout << "Please input a string." << endl; cout << "Enter the EOF character if you want to end this program." << endl; while ( cin.getline(input,80,'\n') ) change( input ); return 0; } void change( char input[] ) { int i, count = 0; for ( i = 0; input[ i ] != '\0'; i++ ) count++; for ( i = count - 1; i >= 0; i-- ) cout << input[ i ]; cout << endl; } -- 感謝猴子人.... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.174.157.31
文章代碼(AID): #_qrUmaJ (NTUBIME96-HW)