題目說明

這題要我們輸出一隻ascii 字元貓 ~

^ ^
(=-w-=)----?
" " " "

解題過程

這題只需要按照題目輸出三行文字即可。只需要特別注意第三行的雙引號,在 C 語言中作為字串的標記,因此需要特別做處理。

複製題目的敘述,我們可以獲得這個未處理的三行字串。

#include <iostream>
using namespace std;

int main() {
    cout << " ^   ^      ";
    cout << "(=-w-=)----?";
    cout << "  " "   " " ";
}

分別在行尾加上換行符號 \n,以及在雙引號的地方加反斜線 \

#include <iostream>
using namespace std;

int main() {
    cout << " ^   ^      \n";
    cout << "(=-w-=)----?\n";
    cout << "  \" \"   \" \" \n";
}

解題成果

#include <iostream>
using namespace std;

int main() {
    cout << " ^   ^      \n";
    cout << "(=-w-=)----?\n";
    cout << "  \" \"   \" \" \n";
}