项目可行性研究的方法:求助VC高手!····

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/02 18:01:02
题号:12

题目要求:
已知6≤a≤30,15≤b≤36,求满足不定方程2a+5b=126的全部整数组解。如(13,20)就是满足方程的解。把所有的解输出。

题号:42

题目要求:
编写程序,程序的功能是:从键盘输入一行字符,输出该字符串中所有的单词。
如:输入" I am a student."时,则输出“I”、“am”、“a”、“student”;
输入"I am a stu67876dent"时,则输出“I”、“am”、“a”、“stu”、“dent”;

/*第一题*/

#include <conio.h>
#include <stdio.h>

void main() {
int a,b;
for (a=6;a<=30;a++)
for (b=15;b<=36;b++)
if (2*a+5*b==126) printf("%d %d\n",a,b);
}
/*第二题*/
#include <conio.h>
#include <stdio.h>

void main()
{
char buf[256],*temp;
int word;
gets(buf);

temp=buf;
word=0;
while (1)
{
char c=*temp++;
if (c>='A' && c<='Z') {word=1; putch(c); continue;}
if (c>='a' && c<='z') {word=1; putch(c); continue;}
if (c==0) break;
if (word) {putch(' '); word=0;}
}

}

1.化简不定方程a=63-5/2*b

#include <stdio.h>
void main() {
int a,b;
for(b=15;b<=36;b++)
{
if (b%2==0)
{
a=63-5*b/2;
if (a>5 && a<31)printf("%d %d\n",a,b);
}
}
}

2.#include <ctype.h>
#include <stdio.h>
#include <conio.h>

void main()
{
char ch[500],*p;
p=ch;
gets(p);
while (*p)
{
static bool flag=true;
if (isalpha(*p)) {putch(*p);flag=true;}
else
if (flag) {putch(' ');flag=false;}
p++;
}
}

12:
for(a=6;a<=36;a++)
for(b=15;b<=36)
if(2*a+5*b==126)
printf a,b