6
Past Paper 2010 Void enqueuer (Queue queue, int data){ If (end==Maxsize -1){ Printf(“The queue is full”); Break; }else Queue[end] =data end++; } While(not isempty(q)) Data= Dequeue(q) Push(stk,data) End while While(not isempty(stk)) Data = Pop(stk) Enqueue(q,data) End while #include <stdio.h> Int main(){ Int target,num[20],I; Printf(“Please enter the target which you would like to search for”) Scanf(“%d”,&target); For(i=0;i<20;i++){ If(num[i]==target){ Printf(“The target %d is found at position %d”,target,i);

CAPE Computer Science Past Paper C Codes

Embed Size (px)

DESCRIPTION

Some of the functions required

Citation preview

Past Paper 2010Void enqueuer (Queue queue, int data){If (end==Maxsize -1){Printf(The queue is full);Break;}elseQueue[end] =dataend++; }

While(not isempty(q))Data= Dequeue(q)Push(stk,data)End whileWhile(not isempty(stk))Data = Pop(stk)Enqueue(q,data)End while

#include Int main(){Int target,num[20],I;Printf(Please enter the target which you would like to search for)Scanf(%d,&target);For(i=0;i