新加坡狮城论坛

返回列表 发帖 付费广告
查看: 1442|回复: 8

求大神帮忙做C#作业~!!!!

[复制链接]
发表于 24-6-2011 15:33:45|来自:新加坡 | 显示全部楼层 |阅读模式
本帖最后由 海水的蓝色 于 12-3-2016 18:36 编辑

价格好说~





Write a C# Console application called PostFixApp and add the Stack.cs file to your project. This program will do the following:
a.      Create a stack of size 20.
b.      Prompt the user to enter a postfix expression as a string. Eg. 234+56**+
c.       Using a loop, evaluate each character in the string as follows:
·         If the character is a number, push it into the stack.
·         If the character is a mathematical operator, pop the top two numbers from the stack and apply mathematical operation on the numbers.  Eg. in the above example, when + is detected, it will pop 3 and 4 and add them together.
·         Then push the result back into the stack.
d.     After the loop, pop the last number in the stack and display it as the final result.
Enter a postfix expression : 234+56**+
Final result = 212

            Stack Diagram :
                                                                                    6
                                                4                      5          5          30
                                    3          3          7          7          7          7          210      
                        2          2          2          2          2          2          2          2          212

2.   Write a C# Console application called FilterByQueueApp and add the Queue.cs file to your project.   The program will do the following:
a.      Create 2 queues - Q1 and Q2 of size 100 each.
b.      Ask the user to enter a string.
c.       Enqueue all the characters in the string into Q1.
d.     Next, the program will walk through each character in Q1 to see if the character is an alphabet.
e.      If the character is a comma (,), add a forward slash (/) to Q2.
f.        If the character is a number (0-9), add the hash symbol (#) to Q2.
g.      Otherwise, simply add the character to Q2.
h.      Finally, the program should print the size of Q2 and all the characters in Q2.



3.    Write a C# Console application called FindNthNode and add the Node.cs and LinkedList.cs files to your project. The program will do the following:
a.         Randomly generates 10 numbers between 1 and 50, inclusive.
b.        For each random number generated, add it into the front of the linked list.
c.         Next, display all the numbers in the linked list.
d.        Ask the user to enter a number that is between 1 and 10, inclusive.  This number represents the position of a Node in the linked list.  For example, 1 refers to the first Node, 2 refers to the second Node and so on.
e.         Now the program will find the nth Node in the linked list and print its data. For instance, if n is 3, the program should return the data in the 3rd node of the linked list.   



Sample Output Screen

f.        Add a new method in LinkedList.cs called InsertNode() which takes in two integers as parameters.  The first parameter represents the data and the second parameter represents the node position.  This method will create a node with the specified data (1st parameter) and insert it into the specified position (2nd parameter) of the Linked List.   Test the method in the Main() method.
4.   Write a C# Console application called MergeSortedQueueApp and add the Queue.cs file to your project.   Then proceed to do the following:
a.      Create 3 queues (Q1, Q2 and Q3) of size 20 each.
b.      Initialize Q1 and Q2 with numbers in ascending order.  Eg. Q1 may contain 2, 5, 8, 23 and Q2 contains 1, 4, 7, 14.
c.       Compare and combine the data in Q1 and Q2 into Q3 such that the numbers in Q3 are still in ascending order.
d.     Finally, print the size of Q3 and display all the numbers in Q3.
Example output as follows:

Q1 : 2 5 8 23
Q2 : 1 4 7 14
After merging…
Q3 Size = 8
Q3 : 1 2 4 5 7 8 14 23


e.      Enhance your application such that it will still work even when Q1 and Q2 are of different sizes.  For example,  

Q1 : 2 5 8 23
Q2 : 1 4 7 14 30 45
After merging…
Q3 Size = 10
Q3 : 1 2 4 5 7 8 14 23 30 45









发表于 24-6-2011 15:47:40|来自:新加坡 | 显示全部楼层
小狮租房



这。。。这。。。找出X的我就会啊~
回复 支持 反对

使用道具 举报

发表于 24-6-2011 15:50:48|来自:新加坡 | 显示全部楼层
支持学习帖。。。
回复 支持 反对

使用道具 举报

发表于 24-6-2011 16:35:45|来自:新加坡 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 24-6-2011 16:58:49|来自:新加坡 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

发表于 24-6-2011 17:03:29|来自:新加坡 | 显示全部楼层
还好我学的不是IT。。。
回复 支持 反对

使用道具 举报

发表于 24-6-2011 17:39:03|来自:新加坡 | 显示全部楼层
DUDU85 发表于 24-6-2011 17:03
还好我学的不是IT。。。

过来 跟 高才 打声招呼,好啊u
回复 支持 反对

使用道具 举报

发表于 26-6-2011 17:06:50|来自:新加坡 | 显示全部楼层
路过看看
回复 支持 反对

使用道具 举报

发表于 27-6-2011 11:40:29|来自:新加坡 | 显示全部楼层
sg9618 发表于 26-6-2011 17:17
何时交作业?

星期三~~~~
回复 支持 反对

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册会员 新浪微博登陆

本版积分规则

联系客服 关注微信 下载APP 小程序 返回顶部 返回列表