我如何开始这个 [英] How Do I Go About Starting This

查看:87
本文介绍了我如何开始这个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编写另一个名为output_month()的函数,该函数从main()中的调用传递一个int,然后将int值从1输出到该数字。例如,如果将15传递给output_month(),则输出如下; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15彻底检查。输入负值会怎样?









int output_month(int no_of_days)



{

int num;



for (num = 1; num< = no_of_days; num ++);

{



cout<< num<< endl;

}



返回0;

}







int main()

{

int year;

int月;

int no_of_days;



cout<<输入一年;

cin>> ;年;

cout<<输入一个月;

cin>>月;



no_in_month(月,年);



cout<<输入数字;

cin>> no_of_days;



output_month(no_of_days);



返回0;





}

这个代码我有它但是不输出问题的数字

Write another function called output_month() that gets passed an int from a call in main() and then outputs the int values from 1 to that number. For example, if 15 is passed to output_month() the output is as follows; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Check thoroughly. What happens if you enter a negative value?




int output_month(int no_of_days)

{
int num;

for(num=1; num<=no_of_days; num++);
{

cout<<num<<endl;
}

return 0;
}



int main()
{
int year;
int month;
int no_of_days;

cout<<" enter a year ";
cin>>year;
cout<<"enter a month ";
cin>>month;

no_in_month(month, year);

cout<<"Enter number";
cin>>no_of_days;

output_month(no_of_days);

return 0;


}
this code i have for it but wont output numbers for the question

推荐答案

我们不做你的作业:它是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但是我们不会为你做这一切!
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, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


更多的家庭作业,就像如何在2月日历中输出一个月 [ ^ ]。信息是:我们不做你的功课。
More homework, just like How Do I Output One Month In Calendar For Feburary[^]. The message is: we do not do your homework.


这篇关于我如何开始这个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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