Страница 1 из 1

{I+-} и IOResult

Добавлено: 15 апр 2008, 19:27
warobushek
Написал следующую функцию для ввода переменной

Код: Выделить всё

{функция защищенного ввода переменной типа word 0..65535}
function OneScan(str:string):WORD;
var
  n:WORD ;
BEGIN
  writeln(str);
 {директива компилятора, отключающая проверку ввода/вывода}
  while(1=1) do
  BEGIN
	{ fflush(stdin);очистить стандартный поток ввода         }
     {I-}
	 read(n);
     {I+}
	 if(IOresult<>0) then {IOResult проверяет, был ли последний}

     begin             {вызов функции ввода/вывода удачным}
         writeln;
		 writeln('     !!Ошибка ввода, попробуйте снова!!');
     end
	 else break;
  END;{while }

  OneScan:=n;
END;{OneScan}
Почему-то не работает(:
Скажите в чем дело?

Re: {I+-} и IOResult

Добавлено: 15 апр 2008, 19:32
MOTOCoder
Во-первых, {I+} это не директива, а комментарий. Директива будет {$I+}.

Re: {I+-} и IOResult

Добавлено: 15 апр 2008, 20:30
somewhere
Боюсь таким образом реализовать защиту не получится, т.к. ввод целого числа уже изначально построен на реализации ввода для длинных целых (Longint) и лишь потом это число преобразуется в тип данных более низкой разрядности. Поэтому при вводе значения 100000 например в переменную Word - IOResult будет 0, т.к. это число умещается в Longint.

Problems occurred in the arrangement of the composition

Добавлено: 23 июн 2008, 02:27
lovefcs09
3.5 Problems occurred in the arrangement of the compositionLook at the following composition selected from students’ writing:Should Students Take a Part Time Job or Not silkroad online goldIn recent years, taking part-time job is very popular on the campus, more and more students spend more time taking part-time job, and this phenomenon causes a lot of hot argument, is it right or not? In my opinion, we can’t say it is right or wrong directly, because the reason is complex. On the other hand, many students take part-time job in order to reduce the burden of their families because their families have not enough money to support them. So their action is reasonable. We can not say it is not right, as to those students whose families are not very poor, some of them taking part-time job just want to practice in the society and gain some experience. Earning money is not their main purpose; we cannot say it is right, either.It is not conformed to the Standard English writing. Firstly, in the above text, there is no definite idea. We cannot get the author’s attitude after reading the text. In this sense, this composition is a failure. To English-speaking people they tend to choose one aspect to illustrate. Secondly, the whole text just has one paragraph. Generally speaking, an English composition consists of three parts: the introductory paragraph, the body and the conclusion. So the text should be rewritten as the following:maple story goldIn recent years, taking part-time job is very popular on the campus. More and more students spend more time taking part-time jobs. This phenomenon causes a lot of hot argument. Is it right or not? In my opinion, it is right based on the following reasons.FFXI GilFirstly, they can reduce the burden of their families, because their families just cannot afford the tuition. In addition, where their life expenditure comes from? Considering this, many students may choose to take part-time jobs to reduce their financial pressure.dofus kamasSecondly, by taking part-time jobs, students could gain more social experience. Knowledge is a treasure, but practice is the key to it. There is always some gap between what we know from textbooks and what we can do in the real world, and social practice helps us build the bridge over it. If you are a qualified student, working as a private teacher will enable you to test out the theories acquired in classroom and to guide you to make your own discoveries. From the above mentioned, we can see that taking part-time jobs has many advantages. It is beneficial to the college students. So do not hesitate, join in the line!The rewritten text is clearer than the original one, after reading the above text. We can easily understand the author’s opinion with sufficient supporting arguments. In addition, the text is fully conformed to the three-part model of English writing.world of warcraft gold