如何将下列程式输出如图形

Home Home
引用 | 编辑 chpo
2009-04-30 12:06
楼主
推文 x0
1.如何将下列程式输出如图形

1
22
333
4444
55555


程式码:

1 #include< >
2 #include< >
3 void main()
4 {int i=_______________,j;
5 do
6 {cout.width(___________);
7 j=________________;
8 do
9 {cout <<__________;
10 _______________;
11 ..

访客只能看到部份内容,免费 加入会员



献花 x0
引用 | 编辑 leacks
2009-05-06 23:34
1楼
  
应该又是相传中的学校作业
下面的题目应该不只那些吧

而且getch是啥阿

第一题非常简单
#include "stdafx.h"
#include "iostream"
#include "stdlib.h"
#include "time.h"

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
     int i,j;
  for(i=1;i<=5;i++)
        {
          for(j=1;j<=i;j++) cout<<i;
          cout<<"\n";
        }
     system("pause");
     return 0;
}

当然你要改while也可以,范例都给你了
基本上这是for的题目,所以你们老师应该有先出for的题目

献花 x0
引用 | 编辑 teldeanmac85
2009-05-08 13:35
2楼
  
#include <iostream.h>
#include <conio.h>

void main()
{
    int i= 1 ,j;
    do{
      cout.width(1);
      j=1;
      do{
        cout <<j;
        j++;
      } while (j<=i);
    cout<< endl;
    i++;
    }while (i<=5);
     
    getch();
}

chpo :
  我觉得你应该需要这些答案吧
  加油啰 ~

leacks :
  getch()与getchar()大同小异
  但是getch()必须include conio.h

表情

献花 x0