Click here to Skip to main content
14,210,385 members

Managed C++/CLI

 
QuestionMessage Closed Pin
27-Nov-17 21:16
memberMember 1354502927-Nov-17 21:16 
AnswerRe: project $50 reward need in 24 hours Pin
Pete O'Hanlon27-Nov-17 21:18
protectorPete O'Hanlon27-Nov-17 21:18 
QuestionISSUE - TCP/IP sockets in MFC VS2017 Pin
D.Manivelan21-Nov-17 1:22
memberD.Manivelan21-Nov-17 1:22 
AnswerRe: ISSUE - TCP/IP sockets in MFC VS2017 Pin
Jochen Arndt21-Nov-17 1:59
mveJochen Arndt21-Nov-17 1:59 
AnswerRe: ISSUE - TCP/IP sockets in MFC VS2017 Pin
jschell22-Nov-17 9:05
memberjschell22-Nov-17 9:05 
QuestionTo sort an array of integer's with recursive functions ? Pin
Tarun Jha18-Nov-17 3:46
memberTarun Jha18-Nov-17 3:46 
GeneralRe: To sort an array of integer's with recursive functions ? Pin
PIEBALDconsult18-Nov-17 3:56
protectorPIEBALDconsult18-Nov-17 3:56 
SuggestionTo find hcf of n number by using only loops. Pin
Tarun Jha4-Nov-17 2:20
memberTarun Jha4-Nov-17 2:20 
This is the code i came up with but it's too long, how to short it down.

#include <conio.h>
#include <stdio.h>

int main(){
	int i=0, j, num[100], count=0, k, hcf[50], min;

	//entering integers, Enter 0 to exit the loop.

	printf("Enter your numbers: \n");

	do{
		scanf("%d", &num[i]);
		i++;
		count++;

	}while(num[i-1]!=0);

	/*
	here we find the minimum number, because we want to find the common factor, hence the factor
	cannot be > min number entered cause then it will not be common factor in all.
	Therefore the min number enterd can be the highest factor or the factors can be <= the min int 
	entered.
	*/

	min = num[0];

	for(j=1; j<=count-2; j++){

		if(min>num[j])
			min = num[j];
	}

	//in the code below we find the factors of every integer entered.

	int h=0, n[count-1];

	for(j=0; j<=count-2; j++){

		for(k=1; k<=min; k++){

				if(num[j]%k==0){
					hcf[h]=k;
					h++;
				}
			}

			n[j] = h;	/*here h is the the size of the number of factors for every integer 
							which is saved in n[] array*/
	}

	/*
	In the loop below each factor of the 1st integer is compared with the factors of others number, 
	And if the occurance of any factor of 1st is equal to the number of int intitially
	enterd then that is a common factor an it is saved in max[] array
	*/

	int c=0, max[50], z;

	for(i=0; i<n[0]; i++){

        z=0;

		for(j=n[0]; j<h; j++){

			if(hcf[i]==hcf[j]){	 //here where a factor is checked if it appears in all the int enterd.
                    z++;
            }
        }
        if(z==(count-2)){	
            max[c]=hcf[i];	//here is where all the common factors are saved.
            c++;
        }

	}

	//In the code below the highest of the common factors is founded.

	for(i=1; i<c; i++){

        if(max[0]<max[i])
            max[0]=max[i];
	}

	//Hcf is printed.

	printf("\nHcf : %d\n", max[0]);

	return 0;
}
<pre lang="c++"><pre lang="c++"><pre lang="c++"><pre lang="c++"><pre lang="c++"><pre lang="c++"><pre lang="c++">

GeneralRe: To find hcf of n number by using only loops. Pin
Richard MacCutchan4-Nov-17 21:10
protectorRichard MacCutchan4-Nov-17 21:10 
GeneralRe: To find hcf of n number by using only loops. Pin
Tarun Jha7-Nov-17 6:20
memberTarun Jha7-Nov-17 6:20 
GeneralRe: To find hcf of n number by using only loops. Pin
Richard MacCutchan7-Nov-17 7:00
protectorRichard MacCutchan7-Nov-17 7:00 
QuestionIs every C# feature available in C++/Managed ? Pin
Maximilien11-Oct-17 7:26
memberMaximilien11-Oct-17 7:26 
AnswerRe: Is every C# feature available in C++/Managed ? Pin
Richard MacCutchan11-Oct-17 9:50
protectorRichard MacCutchan11-Oct-17 9:50 
AnswerRe: Is every C# feature available in C++/Managed ? Pin
John Schroedl28-Nov-17 2:03
professionalJohn Schroedl28-Nov-17 2:03 
Questionc++ Pin
Member 1340521911-Sep-17 21:51
memberMember 1340521911-Sep-17 21:51 
AnswerRe: c++ Pin
Jochen Arndt11-Sep-17 22:41
mveJochen Arndt11-Sep-17 22:41 
QuestionGet USB drive letter Pin
Member 101933363-Aug-17 0:22
memberMember 101933363-Aug-17 0:22 
SuggestionRe: Get USB drive letter Pin
Jochen Arndt3-Aug-17 1:10
mveJochen Arndt3-Aug-17 1:10 
GeneralRe: Get USB drive letter Pin
Member 101933363-Aug-17 2:31
memberMember 101933363-Aug-17 2:31 
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 

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
Web01 | 2.8.190618.1 | Last Updated 27 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid