Click here to Skip to main content
15,878,871 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
Questionc++ Pin
Member 1340521911-Sep-17 21:51
Member 1340521911-Sep-17 21:51 
AnswerRe: c++ Pin
Jochen Arndt11-Sep-17 22:41
professionalJochen Arndt11-Sep-17 22:41 
QuestionGet USB drive letter Pin
Member 101933363-Aug-17 0:22
Member 101933363-Aug-17 0:22 
SuggestionRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 1:10
professionalJochen Arndt3-Aug-17 1:10 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:31
Member 101933363-Aug-17 2:31 
GeneralRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 2:34
professionalJochen Arndt3-Aug-17 2:34 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:32
Member 101933363-Aug-17 2:32 
GeneralRe: Get USB drive letter Pin
Richard MacCutchan3-Aug-17 2:38
mveRichard MacCutchan3-Aug-17 2:38 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:43
Member 101933363-Aug-17 2:43 
GeneralRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 2:43
professionalJochen Arndt3-Aug-17 2:43 
Questionsingly linked list Pin
Member 1306030217-Jul-17 23:27
Member 1306030217-Jul-17 23:27 
AnswerRe: singly linked list Pin
Richard MacCutchan18-Jul-17 2:10
mveRichard MacCutchan18-Jul-17 2:10 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 15:14
Member 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
mveRichard MacCutchan18-Jul-17 20:43 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 21:13
Member 1306030218-Jul-17 21:13 
GeneralRe: singly linked list Pin
Richard MacCutchan18-Jul-17 21:41
mveRichard MacCutchan18-Jul-17 21:41 
GeneralRe: singly linked list Pin
Member 1306030218-Jul-17 21:45
Member 1306030218-Jul-17 21:45 
QuestionStuck with one program. Pin
B.Sudhir25-Jun-17 16:58
B.Sudhir25-Jun-17 16:58 
AnswerRe: Stuck with one program. Pin
Jochen Arndt25-Jun-17 21:40
professionalJochen Arndt25-Jun-17 21:40 
GeneralRe: Stuck with one program. Pin
B.Sudhir25-Jun-17 22:14
B.Sudhir25-Jun-17 22:14 
GeneralRe: Stuck with one program. Pin
Member 1496952719-Oct-20 7:29
Member 1496952719-Oct-20 7:29 
AnswerRe: Stuck with one program. Pin
Artur Linov IT25-Jul-17 6:43
Artur Linov IT25-Jul-17 6:43 
AnswerRe: Stuck with one program. Pin
Member 1496952719-Oct-20 7:04
Member 1496952719-Oct-20 7:04 
Questionprinting the customized data through printer in vc++ 6.0 dialog based. Pin
Member 1322408614-Jun-17 19:42
Member 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
mveRichard MacCutchan14-Jun-17 22:50 

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.