摘要: 来自C++Primer编程练习6.11-1 编写一个小程序,读取键盘输入,直到遇到@符号为止,并回显输入(数字除外),同时将大写字符转换为小写,将小写字符转换为大写。 #include<iostream> using namespace std; int main() { char a[50]; c 阅读全文
posted @ 2022-01-19 19:44 唐欢忱 阅读(248) 评论(0) 推荐(0)
摘要: 写入文本到文件 源程序:C++Primer例题6.15 将输入的三个不同类型的变量写入文件中储存。 #include<iostream>#include<fstream> using namespace std; int main()//写入文本到文件 { char automobile[50]; 阅读全文
posted @ 2022-01-17 22:07 唐欢忱 阅读(695) 评论(0) 推荐(0)
摘要: 源程序:C++Primer例题6.14,求5个高尔夫得分的平均数,5个数字依次输入,如果输入非数字,程序将拒绝,并要求用户继续输入数字。 #include<iostream>using namespace std; const int Max = 5; int main(){ int golf[Ma 阅读全文
posted @ 2022-01-16 23:46 唐欢忱 阅读(427) 评论(0) 推荐(0)