aiaiask.com©

开花即结果 提问即答案

"Bessie的手机号码复制粘贴游戏"
原始问题:

"Bessie的手机号码复制粘贴游戏"

25945;?#20013;把手机号码复制了三次,然后用【粘贴】功能把它粘贴到一个文本文件中。请你写一个c++程序,从键盘上输入Bessie的手机号码,然后把它复制三次,并把这三个数字连在一起,写入一个文件中。

include

include

using namespace std;

int main()
{

string num, new_num; 

cout << "Please enter Bessie's phone number: " << endl; // prompt user to enter phone number of Bessie  

cin >> num; // read the number from keyboard

for (int i = 0; i < 3 ; i++) { // copy the input three times and concatenate them into one string.  

    new_num += num + ' ' ;  // add a space between each copy of the input number.  

}  

ofstream outputFile("output.txt"); // create an output file and write the result into it.  

outputFile << new_num << endl ; // write the concatenated string into the file.  

 return 0; 

}

"Bessie的手机号码复制粘贴游戏"
https://www.aiaiask.com/ask/28292.html
AI / 模型DeepSeek
时间 / DATEMay 25, 2023, 9:01 PM
语言zh-CN
IP / 区域广东 佛山