Click here to Skip to main content
14,029,967 members

Managed C++/CLI

 
GeneralRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 2:34
mveJochen Arndt3-Aug-17 2:34 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:32
memberMember 101933363-Aug-17 2:32 
GeneralRe: Get USB drive letter Pin
Richard MacCutchan3-Aug-17 2:38
protectorRichard MacCutchan3-Aug-17 2:38 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:43
memberMember 101933363-Aug-17 2:43 
GeneralRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 2:43
mveJochen Arndt3-Aug-17 2:43 
Questionsingly linked list Pin
Member 1306030217-Jul-17 23:27
memberMember 1306030217-Jul-17 23:27 
AnswerRe: singly linked list Pin
Richard MacCutchan18-Jul-17 2:10
protectorRichard MacCutchan18-Jul-17 2:10 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 15:14
memberMember 1306030218-Jul-17 15:14 
thank you for your reply..

this is the code in klien.c
#include <stdio.h>
#include <stdlib.h>
#include "list.h"

int main(int argc, char *argv[]){
	List L = NULL;
	Position P = NULL;

	L = Construct(L);
	P = Header(L);
	
int i, n, *element;
	printf("Entri element: ");
	scanf("%d", &n);
	element = (int*)malloc(n*sizeof(int));
	for(i =0; i<n; i++){
		printf("Entri element[%d]: ", i);
		scanf("%d", &element[i]);
		Insert(element[i], L, P);
		P = Advance(P);
	}
	printf("\n");
	getLargestElement(L);
	

	return 0;
}

this is the code in list.h
typedef int ElementType;
#ifndef _List_H
#define _List_H

struct Node;
typedef struct Node *PtrToNode;
typedef PtrToNode List;
typedef PtrToNode Position;

List Construct(List L);
Position Header(List L);
void Insert(ElementType X, List L, Position P);
int IsLast(Position P, List L);
Position Advance(Position P);
Position getLargestElement(List L);
int IsEmpty(List L);
#endif


and the last in list.c
#include <stdio.h>
#include <stdlib.h>
#include "list.h"

struct Node{
	ElementType Element;
	Position Next;
};

List Construct(List L){
	L = malloc(sizeof(struct Node));
	if(L==NULL) 
	printf("Memori Kosong dan Tidak Dapat Dialokasi");
	L->Next = NULL;
	return L;
}
Position Header(List L){
	return L;
}

void Insert(ElementType X, List L, Position P){
	Position TmpCell = NULL;	
	TmpCell = malloc(sizeof(struct Node));
	if(TmpCell == NULL) printf("Memori Kosong dan Tidak Dapat Dialokasi");
	TmpCell->Element = X;
	TmpCell->Next = P->Next;
	P->Next = TmpCell;
}


int IsLast(Position P, List L){
	return P->Next == NULL; 
}


Position Advance(Position P){
	return P->Next;
}

int IsEmpty(List L){
	return L->Next == NULL;
}

Position getLargestElement (List L){
	ElementType Largest;
	Position P;
	if(!IsEmpty(L)){
		P = L->Next;
		Largest = P->Element;
		while(!IsLast(P, L)){
			P = P->Next;
			if(P->Element > Largest){
				Largest = P->Element;
			}
			
		}
		printf("element terbesar  adalah: %d\n",Largest);	
	}
	else{
		printf("tidak ada  ");
	}
	return 0;
}


and my problem is i dont know how to make a splitlist function in my email before..
thank you
GeneralRe: singly linked list Pin
Richard MacCutchan18-Jul-17 20:43
protectorRichard MacCutchan18-Jul-17 20:43 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 21:13
memberMember 1306030218-Jul-17 21:13 
GeneralRe: singly linked list Pin
Richard MacCutchan18-Jul-17 21:41
protectorRichard MacCutchan18-Jul-17 21:41 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 21:45
memberMember 1306030218-Jul-17 21:45 
QuestionStuck with one program. Pin
B.Sudhir25-Jun-17 16:58
memberB.Sudhir25-Jun-17 16:58 
AnswerRe: Stuck with one program. Pin
Jochen Arndt25-Jun-17 21:40
mveJochen Arndt25-Jun-17 21:40 
GeneralRe: Stuck with one program. Pin
B.Sudhir25-Jun-17 22:14
memberB.Sudhir25-Jun-17 22:14 
AnswerRe: Stuck with one program. Pin
Artur Linov IT25-Jul-17 6:43
memberArtur Linov IT25-Jul-17 6:43 
Questionprinting the customized data through printer in vc++ 6.0 dialog based. Pin
Member 1322408614-Jun-17 19:42
memberMember 1322408614-Jun-17 19:42 
AnswerRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
Richard MacCutchan14-Jun-17 22:50
protectorRichard MacCutchan14-Jun-17 22:50 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
rahul199514-Jun-17 23:20
memberrahul199514-Jun-17 23:20 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
Richard MacCutchan15-Jun-17 1:04
protectorRichard MacCutchan15-Jun-17 1:04 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
rahul199515-Jun-17 2:27
memberrahul199515-Jun-17 2:27 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
Richard MacCutchan15-Jun-17 2:57
protectorRichard MacCutchan15-Jun-17 2:57 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
Richard MacCutchan15-Jun-17 3:06
protectorRichard MacCutchan15-Jun-17 3:06 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
Richard MacCutchan15-Jun-17 6:15
protectorRichard MacCutchan15-Jun-17 6:15 
GeneralRe: printing the customized data through printer in vc++ 6.0 dialog based. Pin
rahul199515-Jun-17 20:15
memberrahul199515-Jun-17 20:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190419.4 | Last Updated 15 Mar 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid