codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  plz i need help  tpopono at 19:46 on Thursday, February 19, 2009
 

i nead help wiht my homework, i need to make this

-------*
------***
---- *****
(the triangle only)

and i have to use set width and the while loop

#include <iostream>
#include <iomanip>

using namespace std;
int count=0;
int sum=0;
int num;
int line=1;
int main()
{
while(count<4)
{
cout<<"put how many spaces you want for line " <<line<"for the *"<<endl;
cin>>num;

sum=sum+num;

line++;
count++;

}
cout<<setw(num)<<"*"<<endl;

return 0;
}

can someone plz give me and idea of how to do it?, i know this is wrong plz hepl

  Re: plz i need help  ariseadi at 11:43 on Friday, April 24, 2009
 

void main()
{
int l=0,z,n,i,k,j;
clrscr();
printf("enter the number of lines :");
scanf("%d",&n);
z=n;
for(i=1;i<(2*n);i=(i+2))
{
l++;
printf("\t\t");
for(k=z;k>1;k--)
{
printf(" ");
}
z--;
for(j=1;j<=i;j++)
{
if(j==1||j==i)
printf("1");
else if (l>=2)
printf ("TRIANGLE:%d",l);
}
printf("\n");
}
getch();
}












CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Re: C++ Inheritance Polymorphism
•  Re: getting an object`s property which is decided by content of variable.
•  Re:
•  Re: The date
•  Re: tables
•  Re: java who needs it
•  Re: Add an OnChange event to an ASP page
•  Re: plz i need help
•  Re: open excel file in html page


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2009