📄 oldmac2.cpp
字号:
#include <iostream>#include <string>using namespace std;// working version of old macdonald, functions with more than one parametervoid EiEio(){ cout << "Ee-igh, Ee-igh, oh!" << endl;}void Refrain(){ cout << "Old MacDonald had a farm, "; EiEio();}void HadA(string animal){ cout << "And on his farm he had a " << animal << ", "; EiEio();}void WithA(string noise)// the principal part of a verse { cout << "With a " << noise << " " << noise << " here" << endl; cout << "And a " << noise << " " << noise << " there" << endl; cout << "Here a " << noise << ", " << "there a " << noise << ", " << " everywhere a " << noise << " " << noise << endl;}void Verse(string animal, string noise){ Refrain(); HadA(animal); WithA(noise); Refrain();}int main(){ Verse("pig","oink"); cout << endl; Verse("cow","moo"); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -