代码搜索结果

找到约 10,000 项符合 L 的代码

l16.2a

#print Write a program which reads a file with lines of up to 200 characters and shortens them to 60 characters by throwing away any characters past the first 60. Compile and test it; then type "ready

l1.1a

#print (Section 1.1) The way you compile a C program is to say cc name.c where name.c is the name of the file the program is on. Here is a short C program that prints out a line containing "hello"

l42.1a

#print Write a function inprod(a,b,n) that computes the inner product of two integer vectors a and b which are n items long. Name the file "inprod.c" and compile and test it; then type ready. You m

l17.1a

#print Write in a program which reads its input and writes it out line numbered, with a three-digit line number (starting at one) followed by a single space and then by the original line. Note: the pr

l18.1a

#print There is nothing to force you to write a main program on each file; just as I supplied "getnum" on a separate file, you can put different routines on different files. Write a function "length(

l3.1a

#print (Section 1.3) The file Ref.c contains a copy of a program to convert Fahrenheit to Celsius that prints from 0 to 300 degrees in steps of 20. Modify it to print from 300 down to 0 in steps of 50

l41.1a

#print The problem is to produce a function bitct(x) which examines the bits in x, returning a count of the number of 1-bits. There are various ways of doing this job: here are two. (1) a sane way.

l11.2a

#print With your 'cc' command you can give the name of an object file to be loaded with your program. For example cc x.c y.o will load the previously compiled program 'y' along with the program 'x'

l37.1a

#print Let's try a recursive function. Write a subroutine power(x,n) which computes x to the power n by the following algorithm: 1. if n is zero return 1. 2. if n is odd return x*power(x,n-1).

l14.2a

#print Using the "getnum" routine on "getnum.o", write a program that reads a list of positive numbers and prints their sum. Stop reading numbers when "getnum" returns a negative or zero value. Compi