中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-14 23:40
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS开发编程 & 发展交流 (开发室) » Question about a C language program, Urgent!!!
Printable Version  1,456 / 1
Floor1 rodney Posted 2002-12-11 00:00
初级用户 Posts 4 Credits 119
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.
Floor2 rodney Posted 2002-12-11 00:00
初级用户 Posts 4 Credits 119
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
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023