Học tại trường Chưa có thông tin
Đến từ Chưa có thông tin , Chưa có thông tin
Số lượng câu hỏi 12
Số lượng câu trả lời 0
Điểm GP 0
Điểm SP 0

Người theo dõi (1)

Phiêu

Đang theo dõi (0)


Chủ đề:

Bài 15: Thao tác với tệp

Câu hỏi:

Cho tệp văn bản DAYSO.INP có cấu trúc:

+ Dòng 1: Ghi số nguyên dương N  (0<N<=100)

+ Dòng 2: Ghi dãy gồm n số nguyên Ai (-30000<=Ai<=30000).

Yêu cầu: Viết chương trình đọc dữ liệu từ tệp trên và thực hiện các công việc sau:

a) Tính tổng các số ở dòng 2, ghi kết quả vào tệp TONG.OUT theo cấu trúc:

+ Dòng 1: Ghi số nguyên S là tổng tìm được

b) Tính tổng các số dương ở dòng 2, ghi kết quả vào tệp TD.OUT theo cấu trúc:

+ Dòng 1: Ghi số nguyên S là tổng các số dương tìm được

c) Đếm số lượng các số chẵn ở dòng 2, ghi kết quả vào tệp SOCHAN.OUT theo cấu trúc:

+ Dòng 1: Ghi số nguyên k là số lượng số chẵn

+ Dòng 2: Ghi các số chẵn tìm được, các số ghi cách nhau 1 dấu cách trống.

d) Đếm số lượng các số âm chẵn ở dòng 2, ghi kết quả vào tệp SOAMCHAN.OUT theo cấu trúc:

+ Dòng 1: Ghi số nguyên k là số lượng số âm chẵn

+ Dòng 2: Ghi các số âm chẵn tìm được, các số ghi cách nhau 1 dấu cách trống.

e) Sắp xếp các số ở dòng 2 để được dãy không giảm, ghi kết quả vào tệp SAPXEP.OUT theo cấu trúc:

+ Dòng 1: Ghi dãy số đã được sắp xếp, các số ghi cách nhau 1 dấu cách trống.

f) Đếm số lượng các số nguyên tố ở dòng 2, ghi kết quả vào tệp NTO.OUT theo cấu trúc:

+ Dòng 1: Ghi số nguyên k là số lượng số nguyên tố

+ Dòng 2: Ghi các số nguyên tố tìm được, các số ghi cách nhau 1 dấu cách trống.

HƠI DÀI NHMA MONG MẤY BẠN GIÚP CHỨ MÌNH CHỊU R

Chủ đề:

Luyện tập tổng hợp

Câu hỏi:

50. You never know what’s going to happen, do you?

One...............................................................................................................

51. If she feels worse during the night, give her this medicine.

Should..........................................................................................................

52. He came quietly because he didn’t wnat to wake up the baby.

He came quietly so.......................................................................................

53. They worked together very hard but only Mary passed the exam.

They worked together very hard but only Mary was.....................................

54. He said it was my fault, which was unkind.

It was unkind................................................................................................

55. He said the car must be repaired soon.

He insisted on the car...................................................................................

56. I was amazed by the things he said.

I thought what..............................................................................................

57. You’re allowed to eat at that restaurant without wearing a tie.

You don’t.....................................................................................................

58. It would be a pity to sell this house.

Let’s.............................................................................................................

59. “Why don’t you go away for a few days?” John suggested to me.

John suggested.............................................................................................

60. What do you do when you see a meat seller in the street?

How do you..................................................................................................

61. The photographs are quiet different from the actual holiday location.

These pictures have......................................................................................

62. Although John was over seventy, he continued to cycle to work every day.

Despite.........................................................................................................

63. Please don’t invite Mary to stay for teh weekend.

I’d rather.......................................................................................................

64. It’s a pity I haven’t got a new dress to wear to the party.

I wish...........................................................................................................

65. How long have you been reading “Hamlet”?

When............................................................................................................

66. I’d rather prefer not to go out this evening.

I’d rather.......................................................................................................

67. Mr. Smith must be called immediately.

It is vital.......................................................................................................

68. John doesn’t expect to get the job.

John would be..............................................................................................

69. They didn’t want to be late for the meeting so they left in plenty of time.

So.................................................................................................................

70. When did they first use computers in our banks?

How long is..................................................................................................

71. Martin’s eyes were tested two months ago.

Martin..........................................................................................................

72. When I saw snow I remembered to take my fur coat.

The snow......................................................................................................

73. They only went to bed at 1 a.m

It wasn’t ......................................................................................................

74. My son Martin’s very happy and pleased to be going on holiday soon.

My son Martin’s looking..............................................................................

75. I am fond of my son although he dresses terribly.

I am fond of my son in spite.........................................................................

76. The east of Poland is drier than the west.

There is not...................................................................................................

77. The headmaster did not allow the pupils to leave the school before 2 p.m.

The headmaster made...................................................................................

78. There may be an admission fee.

You..............................................................................................................

79. The report recommended that the factory should be closed immediately.

The report recommended .............................................................................

80. What is wrong with letting parents choose the school they want their children to attend.

Why not........................................................................................................

81. He has no cause to complain.

There is no reason why.................................................................................

82. What I like most about him is his honesty.

His honesty, more.........................................................................................

83. Even if they had played better, they’d still have lost.

However.......................................................................................................

84. It would be a pity to quarrel about it.

Let................................................................................................................

85. He is likely to be late.

It looks.........................................................................................................

86. Please don’t let me forget to go to the dentist.

Could you.....................................................................................................

87. He has some interesting things to say about life in England.

Some of........................................................................................................

88. The reason for John’s sudden departure remained unknown.

No one..........................................................................................................

89. I’d rather drink tea than coffee.

Given............................................................................................................

MÌNH CẢM ƠN NHỮNG BẠN GIÚP MÌNH Ạ