关于c语言组合问题问题啊

一个C语言的题目 求解答啊 急用_百度知道
一个C语言的题目 求解答啊 急用
建立一个空线性链表,要求完成如下操作:在链表尾部依次插入数据元素7,8,9,10,11,每次插入后输出链表中所有的数据元素。在10之前插入20,插入后输出链表中所有的数据元素。在11之前插入30,插入后输出链表中所有的数据元素。
提问者采纳
楼主你好~代码如下,附件附上,请笑纳。#include&&stdio.h&#include&&stdlib.h&#define&Insert(a,b)&b-&next&=&a-&&a-&next&=b&//&在a后插入b#define&InsertTail(h,b)&h-&tail-&next&=&b;&h-&tail&=&b&//&在链表尾插入结点typedef&struct&mNode*&pNtypedef&struct&mNode{& & pNode&& & union& & {& & & & int&& & //&使用联合体,头结点内容为尾结点地址,普通结点内容为整形数& & & & pNode&& & };}myN//&在某个值结点之前插入结点void&InsertBefore(myNode*&head,&int&contentRes,&int&contentInsert){& & while(NULL&!=&head-&next)& & {& & & & if(head-&next-&content&==&contentRes)& & & & {& & & & & & myNode*&_& & & & & & _add&=&(myNode*)malloc(sizeof(myNode));& & & & & & _add-&content&=&contentI& & & & & & _add-&next&=&NULL;& & & & & & Insert(head,&_add);& & & & & && & & & }& & & & head&=&head-&& & }}//&在链表尾插入值void&AddContentToTail(myNode*&head,&int&content){& & myNode*&_& & _add&=&(myNode*)malloc(sizeof(myNode));& & _add-&content&=&& & _add-&next&=&NULL;& & InsertTail(head,&_add);}//&遍历打印链表void&printList(myNode*&node){& & if(NULL&!=&node)& & {& & & & printf(&%d\n&,&node-&content);& & & & printList(node-&next);& & }}int&main(){& & myNode*&& & head&=&(myNode*)malloc(sizeof(myNode));& & head-&tail&=&& & head-&next&=&NULL;& & AddContentToTail(head,&7);& & AddContentToTail(head,&8);& & AddContentToTail(head,&9);& & AddContentToTail(head,&10);& & AddContentToTail(head,&11);& & printList(head-&next);& & printf(&\n&);& & InsertBefore(head,&10,&20);& & printList(head-&next);& & printf(&\n&);& & InsertBefore(head,&11,&30);& & printList(head-&next);& & return&0;}请追问~!
提问者评价
其他类似问题
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁几道c语言题目
求c语言大神啊_魔兽世界吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:5,638,205贴子:
几道c语言题目
求c语言大神啊收藏
小弟马上c语言考试
老师勾的题大部分都不会
望万能的窝吧能帮帮我
求大神啊~~~1.
Write a program to compute the value of Euler’s number e, which is used as the base of natural logarithms. Use the following formula.
e = 1+ 1/1! + 1/ 2! + 1/3! +…… + 1/n! Use a suitable loop construct. The loop must terminate when the difference between two successive values of e is less than 0.00001. 2.
Write program to print the following outputs using for loops. ***** **** *** ** *3.
Write program to print the following outputs using for loops. * ** *** **** ***** 4. Write program to print the following outputs using for loops. * *** ***** ******* ********* 5.
The numbers in the sequence 1 1 2 3 5 8 13 21 ……. are called Fibonacci numbers. Write a program using a do…while loop to calculate and print the first m Fibonacci numbers. 6.
Given a number, write a program using while loop to reverse the digits of the numbers. For example, the number 12345 should be written as 54321 (Hint: Use modulus operator to extract the last digit and the integer division by 10 to get the n-1 digit number from the n digit number.) 7.
Write a program to evaluate the equation y = xn , When n is a non-negative integer. 8.
Write a program to print all the daffodil numbers. Daffodil numbers are those numbers, which are 3-digit numbers, sum of cubic of each digit equals to the number, for example, 153=13+53+33 9.
Input a positive number from keyboard, and then judge whether the input number is a prime, if it is a prime, then print “yes”, else print “no”. 10.
Input a number n from keyboard, then calculate
1!+2!+…+n!. 11.
Input a number n from keyboard, then calculate
1+(1+2)+(1+2+3)+…+(1+2+3+…+n). 12.
Input a year n from keyboard, and then judge whether the year is a leap year. Leap year is a year which satisfies only one of the following conditions: (1) It is divisible by 4, but not divisible by 100 (2) It is divisible by 400.13. Write a program according to the following function, which requires input x from keyboard, then output the corresponding y.14. Input an arithmetic expression from keyboard, and then output its result. Format of the arithmetic expression is as follows, a op b, in which a and b are integers, op is operand, such as +、-、*、/、%. 15. We all knew that the months 1, 3, 5, 7, 8, 10, 12 in 1998 has 31 days, months 4, 6, 9, 11 has 30 days, month 2 has 28 days. Write a program to give days of the month, which requires input month from keyboard. 16. Input a positive number from keyboard, and then judge whether the input number is divisible by 3 and divisible by 5, and then print “yes” or “no” respectively.
<div class="clearfix BAIDU_CLB_AD BAIDU_CLB_AD_pb" id="BAIDU_CLB_AD_">
17. Write a program which requires input a character from keyboard, and then print the character itself and its ASCII value. 18. Calculate the following expressions, then gives the results. (1)x+a%3*(int)(x+y)%2/4,设x=2.5,a=7,y=4.7 (2)(float)(a+b)/2+(int)x%(int)y,设a=2,b=3,x=3.5,y=2.5 19. Give the results of the following programs. void
main() { int
i,j,m,n; i=8, j=10; m=++i;n=j++; printf(“%d,%d,%d,%d\n”,i,j,m,n); }
main() { int
a,b,c,i=5; a=i++; b=++i; --i; c=i--; printf(“a=%d,b=%d,c=%d\n”,a,b,c); } 20.
Input a number from keyboard, if the number is great or equal 0, then print its square root, else print “input wrong number” 21. Write a program to evaluate the equation sum = 1+ 1/2 + 1/3 + 1/4 +…+ 1/n,
while n is put from keyboard. 22.
Write a program that prints the even numbers from 1 to 100. 23.
Write a program that prints the odd numbers from 1 to 100. 24.
Input two numbers x and y from keyboard, find the maximum. 25. Man retires at 60, female retires at 55, please input man or female’s age and sex, then judge whether he or she retires or not. Take F or f to indicate female, M or m to indicate male. 26.
Input three integers a, b and c from keyboard, calculate the roots of equation ax2+bx+c=0(a≠0), maintaining 2 digits after decimal point.. 27.
Input a 3-digit number from keyboard, and then judge whether it is a daffodil number. Daffodil numbers are those numbers, which are 3-digit numbers, sum of cubic of each digit equals to the number, for example, 153=13+53+33 28. Write a program according to the following function, which requires input x from keyboard, then output the corresponding y.
29. Write a program, input three edges of the triangle, and figure out its area. Hints, sum of every two edges must be greater than the third edge, for unreasonable edges, error message should be given, 30. Input a character from keyboard, if it is a lowercase, change into upper case, if it is an uppercase, change into lower case, else print the original character. 31. The following formula converts the given temperature in Fahrenheit to Celsius
, in which, C shows temperature in Celsius, F shows temperature in Fahrenheit. Write a program, input the given temperature in Fahrenheit, and then output in Celsius, maintaining 2 digits after decimal point.
....瞬间沉了啊 自己顶
C语言真心不会
登录百度帐号我的游戏推荐游戏
后查看最近玩过的游戏
使用签名档&&
为兴趣而生,贴吧更懂你。或关于c语言很简单的一个问题!!_百度知道
关于c语言很简单的一个问题!!
三. 已知int a=3,b=4,c=5,x,y;求下列各表达式的值(1) a+b&c&&b==c(2) a||b+c&&b-c(3) !(a&b)&&!c||1(4) !(x=a)&&(y=b)&&0(5) !(a+b)+c-1&&b+c&#47;2谁能告诉我答案??还有解题的思路(怎么想的或是用c编程的程序怎么具体输入)谢谢!
我看书了可是看不明白阿
马上就期中考试了 这是老师给的复习题。大家帮帮忙吧~~~ 如果编程解决的话应该输入完整的程序是什么??谢谢
提问者采纳
//为了你看的清晰就这么些了 #include&stdio.h& void main() { int a=3,b=4,c=5,x,y; printf(&%d&#92;n&,a+b&c&&b==c);//a+b&c&&b==c的值 printf(&%d&#92;n&,a||b+c&&b-c );//a||b+c&&b-c的值 printf(&%d&#92;n&,!(a&b)&&!c||1 );//!(a&b)&&!c||1的值 printf(&%d&#92;n&,!(x=a)&&(y=b)&&0);//!(x=a)&&(y=b)&&0的值 printf(&%d&#92;n&,!(a+b)+c-1&&b+c/2);//!(a+b)+c-1&&b+c/2的值 } /*你的C语言书后肯定有符号优先级,仔细看看,优先级弄明白就明白了,好好复习,int float double sign unsign什么的好好看看,主要就是基础知识,for循环 printf语句,scanf语句好好看看,还有流程图!&&与 ||或 !非。一定要看好优先级 1||x为1,0&&x为0.简单的一定要懂,好好复习啊!!
提问者评价
哦!明白了~谢谢你啊~~~~
其他类似问题
按默认排序
其他3条回答
我算出来得0 1 1 0 1,知道运算符的意义和顺序就能算了。逻辑非、加和减同级、逻辑与和逻辑或同级;后两个同级间都是从左往右算。你自己算算,我不一定对。
具体答案我不告诉你了!你看看书上各种算符的优先级,先计算优先级高的,自己算算更有好处,这样有助于自己的学习!记得加分哟!
编程debug解决
c语言的相关知识
等待您来回答
您可能关注的推广回答者:回答者:
下载知道APP
随时随地咨询
出门在外也不愁关于C语言的题目,帮忙解答啊,答案是9,这是参考答案,但网上很多人说是8,也有说9的_百度知道
关于C语言的题目,帮忙解答啊,答案是9,这是参考答案,但网上很多人说是8,也有说9的
若管篓蒂男郦萌垫职叮涩以下变量均是整型,且num=sum=7;则执行表达式sum=num++,sum++,++num后sum的值为()。
num=sum=7;sum=num++; ==& sum = 7, num =8;sum++;===&sum =8;++ ===& num =9;sum = 8;--------------------------------但是,这是表达式,,表达式运算时,sum=num++,sum++,++num;赋值高,逗号要低于赋值,结果还是不变;若是sum=(num++,sum++,++num);sum = num = 9;
其他类似问题
按默认排序
其他8条回答
如果你的代码如下:#include &stdafx.h&int _tmain(int argc, _TCHAR* argv[]){
int sum = 7;
int num = 7;
sum = num++;
printf(&sum =%d&#92;n&,sum);
printf(&num =%d&#92;n&,num);
return 0;}那么输出为:sum = 8num = 9
觉得是9吧。。 sum=num++sum=7+1sum++sum=9++num和sum无关
个人认为num的值是9,sum的值是8.++运行符如果在变量后面的话,就会先计算这个表达式的值后再运行++运算有关++运算符的优先级,你可以这样理解当++在变量前面的时候,处于第二优先级,当++在变量之后时,你可以将++的优先级看成最低级的,比逗号运算符的优先级还低
sum=num++ -- sum=7,num=8sum++ sum=8num++ num=9sum最后的值为8
在这一步,num先把值赋7给sum,然后自身在加1,这时候sum=7,num=8,执行完sum
num后sum=8,num=9. 我也想不出来sum=9是怎么算的。
9,因为等号的优先级最低了
9啊。。逗号要低于赋值,结果还是不变
是8 ,VC运行的结果。
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 c语言组合问题 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信