Skip to content

Commit e5c7d98

Browse files
author
lulongfei
committed
update express5.3
update assign 4.13
1 parent 5a365a6 commit e5c7d98

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

assign4.13.10.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ int main()
55
{
66
std::array<float, 3> data;
77
std::cout << "Please input three times running record: " << std::endl;
8-
9-
std::cin >> data[0];
10-
std::cin >> data[1];
11-
std::cin >> data[2];
12-
13-
//data.at(0) = firstTime;
14-
//data.at(1) = secondTime;
15-
//data.at(2) = thirdTime;
8+
std::cin >> data[0] >> data[1] >> data[2];
169

1710
int times = data.size();
1811
float average = (data[0] + data[1] + data[2]) / times;

express5.3.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
3+
int main()
4+
{
5+
using namespace std;
6+
int x;
7+
8+
cout << "The expression x = 100 has the value ";
9+
cout << (x = 100) << endl;
10+
cout << "Now x = " << x << endl;
11+
cout << "The expression x < 3 has the value ";
12+
cout << (x < 3) << endl;
13+
cout << "The expression x > 3 has the value ";
14+
cout << (x > 3) << endl;
15+
cout.setf(ios_base::boolalpha);
16+
cout << "The expression x < 3 has the value ";
17+
cout << (x < 3) << endl;
18+
cout << "The expresion x > 3 has the value ";
19+
cout << (x > 3) << endl;
20+
21+
return 0;
22+
}

formore.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <iostream>
2+
3+
const int ArSize = 16;
4+
5+
int main()
6+
{
7+
long long factorials[ArSize];
8+
factorials[1] = factorials[0] = 1LL;
9+
for(int i = 2; i < ArSize; i++)
10+
{
11+
factorials[i] = i * factorials[i-1];
12+
}
13+
for(int i = 0; i < ArSize; i++)
14+
{
15+
std::cout << i << "! = " << factorials[i] << std::endl;
16+
}
17+
return 0;
18+
}

0 commit comments

Comments
 (0)