China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-01 13:15
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Question about a C language program, Urgent!!! View 1,256 Replies 1
Original Poster Posted 2002-12-11 00:00 ·  中国 江苏 常州 电信
初级用户
Credits 119
Posts 4
Joined 2002-12-10 00:00
23-year member
UID 458
Gender Male
Status Offline
Given two sorted singly linked lists, A and B, find C=AUB and D=AnB, and print C and D without changing their sorted order.
Floor 2 Posted 2002-12-11 00:00 ·  中国 江苏 常州 电信
初级用户
Credits 119
Posts 4
Joined 2002-12-10 00:00
23-year member
UID 458
Gender Male
Status Offline
I've implemented part of this program in BASIC for everyone's reference! This program is really needed too urgently. I don't know much about C, so there's no way around it! Please give me a hand, thanks!

INPUT "input dimensions m,n"; m, n
DIM a(m), b(n), c(m * n)
FOR i = 1 TO m
INPUT "input set a"; a(i)
NEXT i
FOR i = 1 TO n
INPUT "input set b"; b(i)
NEXT i
k = 0
FOR i = 1 TO m
LET c(i) = a(i)
NEXT i
FOR i = 1 TO n
FOR j = 1 TO m
IF b(i) = a(j) THEN GOTO h1:
NEXT j
k = k + 1
c(m + k) = b(i)
h1:
NEXT i
h2:
NEXT i
PRINT
INPUT "more input 1(yes) or 0(no)"; x
h3:
IF x = 1 THEN GOTO h3:
END
Forum Jump: