我写了C;里面的字符串统计,汇编不会,不好意思。
看一下这个程序,交流一下:
#include<stdio.h>
#include <string.h>
#define maxstrings 200
struct strs
{
char * strings[maxstrings];
int num;
};
struct strs ST;
int maxchars;
void instrctions()
{
printf("****please input some sets******");
printf("maxchars:");
scanf("%d",&maxchars);
getchar();
}
void getstrings()
{
int i=0;
char *p;
while(1)
{
printf("please input the strings press y");
if(getchar()=='y')
{
getchar();
p=(char*)malloc(maxchars*sizeof(char));
if(p==NULL) exit(0);
scanf("%s",p);
getchar();
ST.strings[i++]=p;
}
break;
}
ST.num=i;
}
void outs()
{
int i;
printf("the strings numbers :%d",ST.num);
printf("Do you want check some strings, please answer \’Y\'or \'N\'");
if(getchar()=='Y')
{ getchar();
for(i=0;i<ST.num;i++)
{ printf("%s\n",ST.strings[i]);
}
}
}
void main()
{
instrctions();
getstrings();
outs();
getch();
}