---
# System prepended metadata

title: C++

---

# C++
## 輸入華氏求攝氏
```cpp=
#include <iostream>

using namespace std;

int main()
{
	double c,f;
	cout<<"華氏?";
	cin>>f;
	c=(f-32)*5/9;
	cout<<"攝氏溫度為"<<c<<endl;
}
```
## 今年幾歲(課本1-23)
```cpp=
#include <iostream>

using namespace std;

int main()
{
	int years;
	cout<<"幾歲?"<<endl;
	cin>>years;
	cout<<"我今年"<<years<<"歲"<<endl;
}
```
## a+b=c
```cpp=
#include <iostream>

using namespace std;

int main()
{
	float a,b,c;
	cout<<"pyosik is best jungler"<<endl;
	cin>>a>>b;
	c=a+b;
	cout<<c;
}
```
## 輸入攝氏求華氏(課本2-18)
```cpp=
#include <iostream>

using namespace std;

int main()
{
	double c,f;
	cout<<"攝氏?";
	cin>>c;
	f=c*9/5+32;
	cout<<"華氏溫度為"<<f<<endl;
}
```