2.2,E2(b)

Error_code copy_stack(Stack dest, Stack source)

           {Error_code detected = success;

            Stack temp;
            Stack_entry item; 
            while (detected ==   success  source.empty( ))  
              {detected = source.top(item);
               detected = source.pop( ); 
               if (detected ==  success) detected = temp.push(item);}  
            while (detected ==   success  temp.empty( ))  
              {detected = temp.top(item); 
               detected = temp.pop( ); 
               if (detected ==  success) detected = source.push(item);
               if (detected ==  success) detected = dest.push(item);}

               return detected;}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Exercises for Programmers: 57 Challenges to Develop Your Coding Skills By 作者: Brian P. Hogan ISBN-10 书号: 1680501224 ISBN-13 书号: 9781680501223 Edition 版本: 1 出版日期: 2015-09-14 pages 页数: 118 When you write software, you need to be at the top of your game. Great programmers practice to keep their skills sharp. Get sharp and stay sharp with more than fifty practice exercises rooted in real-world scenarios. If you’re a new programmer, these challenges will help you learn what you need to break into the field, and if you’re a seasoned pro, you can use these exercises to learn that hot new language for your next gig. One of the best ways to learn a programming language is to use it to solve problems. That’s what this book is all about. Instead of questions rooted in theory, this book presents problems you’ll encounter in everyday software development. These problems are designed for people learning their first programming language, and they also provide a learning path for experienced developers to learn a new language quickly. Start with simple input and output programs. Do some currency conversion and figure out how many months it takes to pay off a credit card. Calculate blood alcohol content and determine if it’s safe to drive. Replace words in files and filter records, and use web services to display the weather, store data, and show how many people are in space right now. At the end you’ll tackle a few larger programs that will help you bring everything together. Each problem includes constraints and challenges to push you further, but it’s up to you to come up with the solutions. And next year, when you want to learn a new programming language or style of programming (perhaps OOP vs. functional), you can work through this book again, using new approaches to solve familiar problems. What You Need: You need access to a computer, a programming language reference, and the programming language you want to use.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值