![HP nld Скачать руководство пользователя страница 290](http://html.mh-extra.com/html/hp/nld/nld_manual_165146290.webp)
Sample nld and noft Session
nld and noft Manual — 520384-003
A- 4
Source Module MODULE1C
The
wrap-up
function displays the number of passengers on the bus at the last stop
and goes through the bus stop array, printing the number of people left at each stop.
The bus stop array is then freed.
Example A-6. Source Module MODULE1C With Edit Line Numbers
.1 #pragma nolist
1 #include <stdlibh>
1.001 #include <stdioh>
1.01 #pragma list
1.011 #include "globals.h"
1.1 #include "module1.h"
1.2 #include "util.h"
2
3 void initialize(long stops)
4 {
4.01 long counter;
4.02 long passenger_count;
4.1
5 bus_stop_array = (long *)malloc(stops*sizeof(long));
5.1 seed_random_number();
6 for (counter = 0; counter < stops; +)
6.01 {
6.02 passenger_count = 0x7F & rand();
6.03 while (passenger_count > BUS_STOP_CAPACITY)
6.04 passenger_count = 0x7F & rand();
6.05
6.1 bus_stop_array[counter] = passenger_count;
7 }
8 } /* initialize */
9
17 void wrapup(long stops)
18 {
19 long counter;
19.01
19.1 printf("Number of people on bus at last stop = %d.\n",
19.11 passengers_on_bus);
19.2 printf("\nPassengers remaining at each bus stop.\n");
19.3 printf("Bus Stop Passenger Count\n");
20 for (counter = 0; counter < stops; +)
20.1 {
20.2 printf("%4d %4d\n", (c 1), bus_stop_array[counter]);
20.3 }
20.4 free(bus_stop_array);
21
22
23 } /* wrapup */
Содержание nld
Страница 12: ...Contents nld and noft Manual 520384 003 x ...
Страница 16: ...What s New in This Manual nld and noft Manual 520384 003 xiv Miscellaneous ...
Страница 22: ...About This Manual nld and noft Manual 520384 003 xx Change Bar Notation ...
Страница 28: ...Introduction to the Utilities nld and noft Manual 520384 003 1 6 strip ...
Страница 60: ...nld Utility nld and noft Manual 520384 003 2 32 Declaration and Definition ...
Страница 78: ...nld Options nld and noft Manual 520384 003 3 18 y ...
Страница 90: ...noft Utility nld and noft Manual 520384 003 4 12 Debugging With noft ...
Страница 150: ...strip Utility nld and noft Manual 520384 003 7 2 ...
Страница 160: ...Converting From Binder to nld and noft nld and noft Manual 520384 003 9 8 Comparing Binder Commands to noft Options ...
Страница 242: ...nld Diagnostic Messages nld and noft Manual 520384 003 10 82 Informational Messages ...
Страница 278: ...noft Diagnostic Messages nld and noft Manual 520384 003 11 36 Syntax Errors ...
Страница 286: ...ar Diagnostic Messages nld and noft Manual 520384 003 12 8 ...
Страница 314: ...Sample nld and noft Session nld and noft Manual 520384 003 A 28 LISTSRLFIXUPS ...
Страница 330: ...Index nld and noft Manual 520384 003 Index 10 Special Characters ...