📄 04_02.cpp
字号:
// 04_02.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include <iostream>
using namespace std;
struct mystruct{
int count;
char s[80];
double balance;
};
ostream& operator << (ostream& out, mystruct& obj)
{
out << " count = " << obj.count;
out << ", balance = " << obj.balance;
out << ", s = " << obj.s << endl;
return out;
}
int main(int argc, char* argv[])
{
mystruct s1, s2;
s1.count = s1.balance = 10;
strcpy(s1.s, "i am the first struct.");
s2.count = s2.balance = 20;
//strcpy(s2.s, "i am the second struct.");
getline(s2.s);
// C输入输出库
//printf("count = %d, balance = %f, s = %s\n", s1.count, s1.s);
//printf("count = %d, balance = %f, s = %d\n", s2.count, s2.balance, s2.s);
// C++的I/0流
cout << s1;
cout << s2;
getch();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -