Click here to Skip to main content
15,918,243 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to Read/Write schema file .xsd in c++ Pin
jschell1-Jan-18 6:30
jschell1-Jan-18 6:30 
GeneralRe: How to Read/Write schema file .xsd in c++ Pin
brraj1-Jan-18 17:56
brraj1-Jan-18 17:56 
GeneralRe: How to Read/Write schema file .xsd in c++ Pin
jschell3-Jan-18 13:08
jschell3-Jan-18 13:08 
QuestionStruct type and memory Pin
Anonygeeker27-Dec-17 18:17
Anonygeeker27-Dec-17 18:17 
AnswerRe: Struct type and memory Pin
Richard MacCutchan27-Dec-17 21:47
mveRichard MacCutchan27-Dec-17 21:47 
QuestionRe: Struct type and memory Pin
David Crow28-Dec-17 2:52
David Crow28-Dec-17 2:52 
AnswerRe: Struct type and memory Pin
Richard MacCutchan28-Dec-17 3:38
mveRichard MacCutchan28-Dec-17 3:38 
QuestionTo write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha26-Dec-17 20:09
Tarun Jha26-Dec-17 20:09 
AnswerRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Victor Nijegorodov26-Dec-17 21:57
Victor Nijegorodov26-Dec-17 21:57 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha26-Dec-17 22:30
Tarun Jha26-Dec-17 22:30 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Victor Nijegorodov26-Dec-17 23:03
Victor Nijegorodov26-Dec-17 23:03 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha26-Dec-17 23:17
Tarun Jha26-Dec-17 23:17 
AnswerRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Richard MacCutchan26-Dec-17 22:29
mveRichard MacCutchan26-Dec-17 22:29 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha26-Dec-17 22:43
Tarun Jha26-Dec-17 22:43 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Richard MacCutchan26-Dec-17 23:28
mveRichard MacCutchan26-Dec-17 23:28 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha27-Dec-17 0:23
Tarun Jha27-Dec-17 0:23 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Richard MacCutchan27-Dec-17 0:25
mveRichard MacCutchan27-Dec-17 0:25 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha27-Dec-17 1:09
Tarun Jha27-Dec-17 1:09 
AnswerRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha27-Dec-17 1:11
Tarun Jha27-Dec-17 1:11 
AnswerRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Vaclav_28-Dec-17 13:24
Vaclav_28-Dec-17 13:24 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Victor Nijegorodov28-Dec-17 21:17
Victor Nijegorodov28-Dec-17 21:17 
GeneralRe: To write a c program to maintain a log of football match b/w 2 teams and then compare the results of the log entered by user and announce the winner. Pin
Tarun Jha31-Dec-17 12:30
Tarun Jha31-Dec-17 12:30 
it works too..

C++
<pre>#include <stdio.h>
#include <string.h>
#include <math.h>

int main()
{
	int log, i, j, k, count1=1, count2=0, c;

	printf("Enter the number of logs: \n");
	scanf("%d%*c", &log);

	char names[log][100];
	
	//Entering names.
	printf("Enter names: \n");
	gets(names[0]);

	//completing in a single loop.
	for(i=1; i<log; i++)
	{
		gets(names[i]);
		if(strcmp(names[i], names[0])!= 0)
		{
			count2++;
			k = i;
			for(j=k+1; j<log; j++)
            {
                gets(names[j]);

                while((strcmp(names[j], names[0])!=0 && strcmp(names[j], names[k])!=0) || ((c=names[j][0])==EOF && c=='\n')) // prevents from entering more than 2 different types of names or giving a blank input.
                {
                    printf("Invalid entry!\n");
                    memset(names[j], 0, sizeof(names[j]));
                    gets(names[j]);
                }
                
                if((strcmp(names[j], names[0])==0))
                {
                	count1++;
				}
				else if((strcmp(names[j], names[k])==0))
				{
					count2++;
				}
            }
            
            if(count1>count2)
            {
            	puts(names[0]);
            	printf("Wins !");
			}
			else if(count2>count1)
			{
				puts(names[k]);
				printf("Wins !");
			}
			else if(count1==count2)
			{
				printf("It's a tie!!");
			}
            break;
		}
		count1++;
	}
	return 0;
}


QuestionClasses hierarchy? Pin
Vaclav_24-Dec-17 7:53
Vaclav_24-Dec-17 7:53 
AnswerRe: Classes hierarchy? Pin
Rick York24-Dec-17 10:36
mveRick York24-Dec-17 10:36 
QuestionCode consuming lot of RAM (Memory) Pin
User 1350945018-Dec-17 23:21
professionalUser 1350945018-Dec-17 23:21 

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.