![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c++
stupidArthur
这个作者很懒,什么都没留下…
展开
-
cout格式化输出
1.小数位数可以使用setprecision()来确定小数位数,加fixed补充末位的0需要添加头文件#include<iomanip>假设 ans=1.202; 以下是保留两位小数,若末尾是0,则省略cout << setprecision(2) << ans <<endl;//输出1.2若想不省略末尾的0,则需要加上fixedcout.setf(ios::fixed);cout << fix原创 2017-01-07 19:10:12 · 297 阅读 · 0 评论 -
PAT BASIC 1004
思路:此题是比较简单的一个模拟题,两个struct类型的变量分别记录第一名和最后一名,另一个变量输入,每次输入就判断并更新第一名和最后一名的信息。 代码:#include<iostream>#include<string>using namespace std;struct Student{ string name; string id; int score;};int ma原创 2017-02-06 20:44:11 · 196 阅读 · 0 评论 -
PAT BASIC 1042
思路:这个题就是个普通的字符串处理的题,不要忘了大小写的处理,没有什么要特殊注意的点。 代码:#include<iostream>#include<string>using namespace std;int main(){ int len, i, j, max = 0; int num[26] = { 0 }; string str; char s; getline(原创 2017-02-25 09:47:37 · 199 阅读 · 0 评论 -
PAT BASIC 1035
思路:代码:arthuryzc [编辑资料] [登出]主页题目集基本信息题目列表提交列表排名帮助查看源代码12345678910111213141516171819202122232425262728293031323334353637383940414243444546#include<io原创 2017-02-25 11:11:46 · 255 阅读 · 0 评论