为此问题提供C ++代码 [英] provide a c++ code fo this question

查看:69
本文介绍了为此问题提供C ++代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写一个程序来模拟生产者消费者问题.生产者具有固定的缓冲区大小,并且在缓冲区满时无法生产.另一方面,消费者的消费形式是由生产者提供的固定缓冲区大小.使用者不能从空的缓冲区中消费

Write a program to model the producer consumer problem. The producer has a fixed buffer size and cannot produce when it is full. On the other side, the consumer consumes form a fixed buffer size that is fed by the producer. The consumer cannot consume from an empty buffer

推荐答案

如果要发布作业,至少要使其看起来像是您自己尝试做某事!

我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

自己尝试一下,或者学一下神奇的单词:您要用它炸薯条吗?"
If you are going to post your homework, at least try to make it look like you have attempted to do something yourself!

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, or learn the Magic Words: "Do you want fries with that?"


您的意思是为此问题提供C ++代码 "?
没有什么比这更容易了!

Do you mean "provide C++ code for this question"?
Nothing could be easier!

#include <iostream>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    cout << "Write a program to model the producer consumer problem. " << 
    "The producer has a fixed buffer size and cannot produce when it is full. " <<
    "On the other side, the consumer consumes form a fixed buffer size that is fed by the producer. " <<
    "The consumer cannot consume from an empty buffer.";
}



注意:问题的精确表述至关重要.

—SA



Note: precise formulation of Question can be critically important.

—SA


这篇关于为此问题提供C ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆