| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 568 人关注过本帖
标题:英语高手请进,因为题目是英文的!!!
只看楼主 加入收藏
xiaolin
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-12-14
收藏
 问题点数:0 回复次数:3 
英语高手请进,因为题目是英文的!!!

Contents:

This assignment gives students the opportunity to work with arrays and sorting.Programs that simulate card games usually have to simulate the operation of shuffling the deck. Like sorting, shuffling is a process that involves rearranging the elements of an array. Algorithmically, the only difference between sorting and shuffling is how you select elements. When you sort an array using selection sort, you choose the smallest element in the rest of the array on each cycle of the loop. When you shuffle an array, you choose a random element. At last, you should sort the 13 cards in descending order by suit.

Steps:

Write a function Shuffle that shuffles an array of strings. To test the Shuffle function, write a program that

1. Declares an array with 52 elements, each of which are strings.

2. Fills the elements of that array with strings representing standard playing cards. Each card is represented by a string consisting of a rank (A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2) concatenated with a single letter representing a suit (C, D, H, S). Thus, the queen of spades is represented by the string "QS". The function IntegerToString described in Chapter 9 (page 302) will probably come in handy here.

3. Shuffles the array using the Shuffle function.

4. Deals a bridge hand by copying the first 13 cards from the deck to a separate array.

5. Sorts the 13 cards in the hand so that the cards are in descending order by suit. When the hand is sorted, all the spades come first, followed by the hearts, the diamonds, and finally the clubs. Within each suit, the cards should be listed in the order given in step 2: first the ace, then the king, then the queen, and so on down to the two. Note that this step requires an operation that is pretty much the same as the Sort function in the text. The only differences are that (1) the array elements are strings and (2) the comparison operation is slightly more complicated. In all other ways, your program should follow exactly the same structure.

6. Displays the 13 cards in the hand on a single line.

The following is a sample run of the program:

Hand: AS 6S AH 10H 7H 4H KD 8D 5D 4D 3D 2D AC

搜索更多相关主题的帖子: 英语 英文 
2004-12-14 21:23
tary
Rank: 1
等 级:新手上路
帖 子:780
专家分:0
注 册:2004-10-5
收藏
得分:0 

强烈建议上英语论坛, 一定有人帮你.


┌→¨ ≮我可以学会对你很冷落≯¨←┐ │  <却学不╓══╦══╖会将爱> │ │¨←┐ ╭╩╮哭‖哭╭╩╮ ┌→¨│ └──┘收 ╲╱ ◇‖◇ ╲╱回└──┘
2004-12-18 00:31
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
得分:0 

含有52个元素的数组分别表示52张牌

用shuffle function 来把这些牌打乱

把最先的13张牌抽出拿在手中

最后再降序排列这些牌,并输出,排的规则是大原则按黑桃,红心,方块,梅花,小原则按牌值由大到小(A~2)


2004-12-19 12:51
牛虻
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2004-10-1
收藏
得分:0 
以下是引用tary在2004-12-18 00:31:02的发言:

强烈建议上英语论坛, 一定有人帮你.

人家英语好的也不一定能翻译的出来,有的是些专业语言呢


土冒
2004-12-19 20:27
快速回复:英语高手请进,因为题目是英文的!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023967 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved