#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,输出应为星形的平方
发布评论