世界上最长的源代码

世界上最长的源代码,第1张

我现在可以给你写出世界上最长的代码啊!请看:

#include <iostream.h>

void main()

{

cout<<"the longest code in the world!"<<endl

cout<<"the longest code in the world!"<<endl

cout<<"the longest code in the world!"<<endl

cout<<"the longest code in the world!"<<endl

cout<<"the longest code in the world!"<<endl

cout<<"the longest code in the world!"<<endl//以下重复999999999999999999999999...次

}

#include "stdio.h"

#include "windows.h"

main()

{

int lastmaxlen = 0 //历史最长单词单词长度

int length=0

char str[] = "sdfsdfdsaaaaaaaaaaaaasddddddddd asdfsdfsdfdsf sdfsdfsdfsd sdfsd sdfsdfsdfsdfsdfsdfsdf "//语句

char *p=str

char *start=str//指向单词开头的指针

char buf[1024]

int count=0

while(*p!='\0')

{

if(*p==' ')

{

printf("count=%d\n ",count)

if(count>lastmaxlen){//如果当前单词的长度大于以前最长的单词

lastmaxlen=count

memset(buf,0,1024)

memcpy(buf,start,count-1)

length=count

printf("%s\n",buf)

}

start = p+1

count=0

}

count++

p++

}

if(count>lastmaxlen){

lastmaxlen=count

memset(buf,0,1024)

memcpy(buf,start,count-1)

length=count

}

printf("longest word is:'%s',length=%d\n",buf,length)

return 0

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11545084.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-16
下一篇 2023-05-16

发表评论

登录后才能评论

评论列表(0条)

保存