user-0 提问: C语言

回复:
user: user-1
content: 希望对你有帮助：https://blog.csdn.net/it_xiangqiang/category_10581430.html 希望对你有帮助：https://blog.csdn.net/it_xiangqiang/category_10768339.html

user: user-0
content: 你这代码不回车也输进去了吗？

user: user-2
content: 引用 4 楼 棉猴的回复:[quote=引用 3 楼 weixin_45949073 的回复:] [quote=引用 2 楼 棉猴的回复:]#include<stdio.h> #include<string.h> int main() { 	int t, n, j; 	char a, b, c; 	int count = 0; 	scanf("%d", &t); 	rewind(stdin); 	int *awin = new int[t]; 	int temp = t; 	while (t) { 		count = 0; 		scanf("%d", &n); 		rewind(stdin); 		for (j = 1; j <= n; j++)  		{ 			//if (j != n) 			scanf("%c%c%c", &a, &b, &c); 			rewind(stdin); 			//else 				//scanf("%c%c%c", &a, &b, &c); 			if (a == 'R')  			{ 				if (c == 'R') 					count += 0; 				else if (c == 'S') 					count++; 				else 					count--; 			} 			else if (a == 'S')  			{ 				if (c == 'S') 					count += 0; 				else if (c == 'P') 					count++; 				else 					count--; 			} 			else  			{ 				if (c == 'P') 					count += 0; 				else if (c == 'R') 					count++; 				else 					count--; 			} 		} 		 		if (count == 0) 			awin[t-1] = 1; 		else if (count>0) 			awin[t-1] = 3; 		else if (count<0) 			awin[t-1] = 0; 		t--; 	} 	for (int i = temp-1; i >= 0; i--) 	{ 		if (awin[i] == 1) 			printf("TIE\n"); 		else if (awin[i] == 3) 			printf("Player 1\n"); 		else if(awin[i] == 0) 			printf("Player 2\n"); 	} 	delete[] awin; 	return 0; } vs2015调试  原来.c也可以用new啊[/quote] 那就改成malloc()和free()嘛。我使用VS2015的C++编译器实现的[/quote] 嗯。。。。。知道了

user: user-3
content: 引用 3 楼 weixin_45949073 的回复:[quote=引用 2 楼 棉猴的回复:]#include<stdio.h> #include<string.h> int main() { 	int t, n, j; 	char a, b, c; 	int count = 0; 	scanf("%d", &t); 	rewind(stdin); 	int *awin = new int[t]; 	int temp = t; 	while (t) { 		count = 0; 		scanf("%d", &n); 		rewind(stdin); 		for (j = 1; j <= n; j++)  		{ 			//if (j != n) 			scanf("%c%c%c", &a, &b, &c); 			rewind(stdin); 			//else 				//scanf("%c%c%c", &a, &b, &c); 			if (a == 'R')  			{ 				if (c == 'R') 					count += 0; 				else if (c == 'S') 					count++; 				else 					count--; 			} 			else if (a == 'S')  			{ 				if (c == 'S') 					count += 0; 				else if (c == 'P') 					count++; 				else 					count--; 			} 			else  			{ 				if (c == 'P') 					count += 0; 				else if (c == 'R') 					count++; 				else 					count--; 			} 		} 		 		if (count == 0) 			awin[t-1] = 1; 		else if (count>0) 			awin[t-1] = 3; 		else if (count<0) 			awin[t-1] = 0; 		t--; 	} 	for (int i = temp-1; i >= 0; i--) 	{ 		if (awin[i] == 1) 			printf("TIE\n"); 		else if (awin[i] == 3) 			printf("Player 1\n"); 		else if(awin[i] == 0) 			printf("Player 2\n"); 	} 	delete[] awin; 	return 0; } vs2015调试  原来.c也可以用new啊[/quote] 那就改成malloc()和free()嘛。我使用VS2015的C++编译器实现的

user: user-2
content: 引用 2 楼 棉猴的回复:#include<stdio.h> #include<string.h> int main() { 	int t, n, j; 	char a, b, c; 	int count = 0; 	scanf("%d", &t); 	rewind(stdin); 	int *awin = new int[t]; 	int temp = t; 	while (t) { 		count = 0; 		scanf("%d", &n); 		rewind(stdin); 		for (j = 1; j <= n; j++)  		{ 			//if (j != n) 			scanf("%c%c%c", &a, &b, &c); 			rewind(stdin); 			//else 				//scanf("%c%c%c", &a, &b, &c); 			if (a == 'R')  			{ 				if (c == 'R') 					count += 0; 				else if (c == 'S') 					count++; 				else 					count--; 			} 			else if (a == 'S')  			{ 				if (c == 'S') 					count += 0; 				else if (c == 'P') 					count++; 				else 					count--; 			} 			else  			{ 				if (c == 'P') 					count += 0; 				else if (c == 'R') 					count++; 				else 					count--; 			} 		} 		 		if (count == 0) 			awin[t-1] = 1; 		else if (count>0) 			awin[t-1] = 3; 		else if (count<0) 			awin[t-1] = 0; 		t--; 	} 	for (int i = temp-1; i >= 0; i--) 	{ 		if (awin[i] == 1) 			printf("TIE\n"); 		else if (awin[i] == 3) 			printf("Player 1\n"); 		else if(awin[i] == 0) 			printf("Player 2\n"); 	} 	delete[] awin; 	return 0; } vs2015调试  原来.c也可以用new啊

user: user-3
content: #include<stdio.h> #include<string.h> int main() { 	int t, n, j; 	char a, b, c; 	int count = 0; 	scanf("%d", &t); 	rewind(stdin); 	int *awin = new int[t]; 	int temp = t; 	while (t) { 		count = 0; 		scanf("%d", &n); 		rewind(stdin); 		for (j = 1; j <= n; j++)  		{ 			//if (j != n) 			scanf("%c%c%c", &a, &b, &c); 			rewind(stdin); 			//else 				//scanf("%c%c%c", &a, &b, &c); 			if (a == 'R')  			{ 				if (c == 'R') 					count += 0; 				else if (c == 'S') 					count++; 				else 					count--; 			} 			else if (a == 'S')  			{ 				if (c == 'S') 					count += 0; 				else if (c == 'P') 					count++; 				else 					count--; 			} 			else  			{ 				if (c == 'P') 					count += 0; 				else if (c == 'R') 					count++; 				else 					count--; 			} 		} 		 		if (count == 0) 			awin[t-1] = 1; 		else if (count>0) 			awin[t-1] = 3; 		else if (count<0) 			awin[t-1] = 0; 		t--; 	} 	for (int i = temp-1; i >= 0; i--) 	{ 		if (awin[i] == 1) 			printf("TIE\n"); 		else if (awin[i] == 3) 			printf("Player 1\n"); 		else if(awin[i] == 0) 			printf("Player 2\n"); 	} 	delete[] awin; 	return 0; } vs2015调试

user: user-0
content: #include<stdio.h> #include<string.h> int main() { int t,n,j; char a,b,c; scanf("%d",&t); while(t){     int count=0;     scanf("%d\n",&n);     for(j=1;j<=n;j++){         if(j!=n)         scanf("%c%c%c\n",&a,&b,&c);         else         scanf("%c%c%c",&a,&b,&c);         if(a=='R'){             if(c=='R')                 count+=0;             else if(c=='S')                 count++;             else                 count--;                  }         else if(a=='S'){             if(c=='S')                 count+=0;             else if(c=='P')                 count++;             else                 count--;                  }         else{             if(c=='P')                 count+=0;             else if(c=='R')                 count++;             else                 count--;                 }        }        if(count==0)            printf("TIE\n");        else if(count>0)            printf("player 1\n");        else if(count<0)            printf("player 2\n");        t--;        } return 0; }