各位高手帮个忙啊,帮我修改这个程序好吗?谢谢你们了.

来源:百度知道 编辑:UC知道 时间:2024/05/25 14:09:40
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>

void danci(char xx[])
{
int i,j,k,strl;char c;
for(i=0;i<40;i++)
{
c=xx[i];
if(c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'&&i>=0);
else
xx[i]=' ';
}
char ch[40]={0};
char pp[40]={0};

strl=strlen(xx);
i=strl-1;
k=1;
while(1)
{
while(xx[i]>='a'&&xx[i]<='z'||xx[i]>='A'&&xx[i]<='Z'||xx[i]>='0'&&xx[i]<='9'&&i>=0)
{
for(j=k;j>=0;j--)
pp[j+1]=pp[j];
pp[0]=xx[i];
k++;
i--;
}
strcat(ch,pp);
strcpy(pp," ");
k=1;
if(i==-1)
break;
while(xx[i]<'0'||xx[i]>'9'&&xx[i]<'A'||xx[i]>

我这没C的编绎器,你自己试一下看对不对吧。

void main()
{
char xx[40];
int i,j;
for(i=0;i<39;i++)
scanf("%s",&xx[i]);
for(j=i;j>-1;j--){
printf(xx[j]);
}
}

我靠,明显欺负我长时间没用C语言了。
刚给你查了一个多小时的C语言资料。
printf()应该加格式控制。printf("%c",xx[i]);
另入,输入字符串也不是你那样输入的。

#include<stdio.h>
#include<string.h>
main()
{
char str[40];
int i;
printf("input string:");
gets(str);
for(i=strlen(str)-1;i>=0;i--){
printf("%c",str[i]);
}
}

没那么多精力帮你弄了,下面是分割字符串的代码,你自己结合着弄吧。

#include <iostream>
#include <string>
using namespace std;

char str[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;

void main(void)
{
cout << "\n\n" << str << "\n&