那位大虾编一个c++函数

[复制链接]
查看11 | 回复3 | 2008-10-30 13:46:08 | 显示全部楼层 |阅读模式
字符串统计
输入
222-3333
222-3333
444-5555
444-5555
444-5555
555-6666
输出
222-3333 2
444-5555 3
只有一个的就不要输了

回复

使用道具 举报

千问 | 2008-10-30 13:46:08 | 显示全部楼层
不输入字符直接回车退出输入过程。#include #include #include #include #include typedef struct _SNode{
char name[16];
int num;
struct _SNode *next;} SNode;void InsertNode(SNode **head, char *name){
SNode *node = *head;
while (node)
{
if (...
回复

使用道具 举报

千问 | 2008-10-30 13:46:08 | 显示全部楼层
calc()函数即可完成统计工作,程序如下:#include #includestruct SSTR { char *str; int x; }; void calc(SSTR *a, int n) { int i, j; for (i=0; i#include #include using namespace std;maps;int main(){string ss;while (cin>>ss)
++s[ss];for(map...
回复

使用道具 举报

千问 | 2008-10-30 13:46:08 | 显示全部楼层
输出需要排序么输入的字符串范围 大小等等...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行