BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

Register FAQ Community Calendar New Posts Navbar Right Corner
HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 1st semester > Object Oriented Programming


Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 1 votes, 5.00 average. Display Modes
  #1  
Old 06-05-2011, 03:50 PM
JuNaiDiQbaL's Avatar
Never Give Up

 
Join Date: Jan 2011
Location: SahiwaL
Age: 31
Posts: 26
Program / Discipline: BSIT
Class Roll Number: 10-26
JuNaiDiQbaL has a spectacular aura aboutJuNaiDiQbaL has a spectacular aura about
Default A Program that prints square pattern stars in the output.

#include <iostream.h>
#include <conio.h>


int main(void)
{
int i;
int j;
int side;
clrscr();
cout<<"Enter side\n";
cin>>side;

for(i=0;i<side;i++)
{
cout<<"*"; //print top row
}

for(j=0;j<side-2;j++) //side-2 to account for top and bottom rows
{
cout<<"\n";
cout<<"*"; //print left side

for(i=0;i<(side-2);i++) //side-2 to account for left and right sides
{
cout<<" "; //print spaces

}

cout<<"*"; //print right side
}

cout<<"\n";

for(i=0;i<(side);i++)
{

cout<<"*"; //print bottom row
}

getch();
}

Reply With Quote
Reply

Tags
output, pattern, prints, program, square, stars


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Program that makes a Diamond Pattern Stars in the output. JuNaiDiQbaL Object Oriented Programming 0 06-05-2011 03:45 PM
Program to enter a letter and output the next 2 letters bonfire Object Oriented Programming 3 10-03-2011 12:25 PM
Program to enter a character and output its ASCII code bonfire Object Oriented Programming 0 09-03-2011 12:14 AM
Program to enter an integer and output it in the reversed form bonfire Object Oriented Programming 0 08-03-2011 11:59 PM
Program to enter an integer and output its 15 multiples bonfire Object Oriented Programming 0 01-03-2011 03:13 PM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 07:12 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.