编写一个完整的C ++程序来输入一个整数N.该数字应小于1000,输出应为星形的平方

编程入门 行业动态 更新时间:2024-10-27 02:24:49
本文介绍了编写一个完整的C ++程序来输入一个整数N.该数字应小于1000,输出应为星形的平方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

#include< iostream> 使用命名空间std; int main() { int x; string s; cout<< 输入一个数字:; cin>> x; for(int i = 1; i< = x; i ++) { s = s +'*'; } cout< ;< s<< endl; 返回0; } 我尝试了什么: #include< ; iostream> 使用命名空间std; int main() { int x; string s; cout<<输入数字: ; cin>> x; for(int i = 1; i< = x; i ++) { s = s +'*'; } cout<< s<< endl; 返回0; }

#include <iostream> using namespace std; int main() { int x; string s; cout<<"Enter a number:"; cin>>x; for(int i=1 ; i<=x ; i++) { s=s+'*'; } cout<<s<<endl; return 0; } What I have tried: #include <iostream> using namespace std; int main() { int x; string s; cout<<"Enter a number:"; cin>>x; for(int i=1 ; i<=x ; i++) { s=s+'*'; } cout<<s<<endl; return 0; }

推荐答案

我们不做你的HomeWork,自我分配也被视为HomeWork。 HomeWork未设置测试你的乞讨技巧其他人做你的工作,它将帮助你的老师检查你对你所学课程的理解,以及你应用它们时遇到的问题。 你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。 所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个确切的问题,我们可能会提供帮助。 建议:拿一张纸并尝试手动解决小数字的问题(从1,2,3,4,5 ......开始)。 看看你如何手动解决它,或多或少,这将是你的程序中的方法。 We do not do your HomeWork, self assignment is also considered as HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them. Any failure of you will help your teacher spot your weaknesses and set remedial actions. So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help. Advice: Take sheet of paper and try to solve manually the problem for small numbers (start at 1, 2, 3, 4, 5 ...). See how you solve it by hand, more or less, it will the method to yse in your program. 引用:

编写一个完整的C ++程序来输入一个整数N.该数字应该小于1000,并且输出应该是星形的正方形

Write a complete C++ program to input an integer N. The number should be less than 1000, and the output should be the square of stars

首先,尝试理解问题! 如果键入1000,是否必须输出1000乘1000的az平方?或者包含1000颗星的(几乎)正方形? 建议:要学习编程,请选择C或C ++之外的其他语言,因为这些语言对程序员不友好,而且很快,这些困难开始弄乱你的代码。选择一种带有失败保险的语言,比如Visual Basic,你会学习相同的编程,但语言会捕捉到你可以错过的错误。 一旦你是一名优秀的Visual Basic程序员,切换到C / C ++并不困难,你只需要学习语言的捕获。

First, try to understand the problem! If you type 1000, do you have to output az square of 1000 by 1000 ? or a (almost) square that contain 1000 stars ? Advice: To learn programming, choose another language than C or C++ because these languages are non programmer friendly, and quickly, these difficulties start to mess in your code. Choose rather a language with fail safes, like Visual Basic, you will learn programming the same, but the language will catch error that you can miss with C. Once you are a good programmer with Visual Basic, it is not difficult to switch to C/C++, you just have to learn the catches of the language.

更多推荐

编写一个完整的C ++程序来输入一个整数N.该数字应小于1000,输出应为星形的平方

本文发布于:2023-11-29 23:41:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:星形   整数   完整   数字   程序

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!