// 成对输入花括号.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
int Add = 0;
char temp;
while ((temp = getchar()) != EOF )
{
if (temp == '}')
{
if (Add == 0)
{
printf("wrong!");
}
else
Add -= 1;
}
if (temp == '{')
{
Add += 1;
}
}
return EXIT_SUCCESS;
}
C和指针 (pointers on C)——第二章:基本概念,布布扣,bubuko.com
C和指针 (pointers on C)——第二章:基本概念
原文地址:http://blog.csdn.net/liyakun1990/article/details/37359761