Click here to Skip to main content
15,894,740 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Memory leak in OnNewDocument() Pin
David Crow17-Mar-08 4:37
David Crow17-Mar-08 4:37 
GeneralRe: Memory leak in OnNewDocument() [modified] Pin
rp_suman17-Mar-08 14:56
rp_suman17-Mar-08 14:56 
GeneralRe: Memory leak in OnNewDocument() Pin
David Crow18-Mar-08 3:15
David Crow18-Mar-08 3:15 
QuestionHow to retrieve date,day ,hour ,minutes,seconds from DateTime Control?? Pin
Ashish Chauhan16-Mar-08 21:05
Ashish Chauhan16-Mar-08 21:05 
AnswerRe: How to retrieve date,day ,hour ,minutes,seconds from DateTime Control?? Pin
Ashish Chauhan16-Mar-08 21:06
Ashish Chauhan16-Mar-08 21:06 
GeneralRe: How to retrieve date,day ,hour ,minutes,seconds from DateTime Control?? Pin
Rajkumar R16-Mar-08 21:22
Rajkumar R16-Mar-08 21:22 
AnswerRe: How to retrieve date,day ,hour ,minutes,seconds from DateTime Control?? Pin
David Crow17-Mar-08 4:38
David Crow17-Mar-08 4:38 
GeneralCreating a Number Spiral Matrix [VC++] Pin
AnkurS16-Mar-08 20:17
AnkurS16-Mar-08 20:17 
hi guys,

this program creates number spiral Matrix

For example :
Enter a number : 4

01 02 03 04
12 13 14 05
11 16 15 06
10 09 08 07



Code :

#include <iostream.h>
int main()
{
int UserNo=1; // default Value
int StoreArray[100][100];

cout<<endl<<"Please enter a number :";
cin>>UserNo;
int Sqr=UserNo*UserNo;
int r=1,c=UserNo;
StoreArray[UserNo][UserNo];
int n=1;

do
{
for (int b=r;b<=c;b++)
{
StoreArray[r][b]=n;
n++;
}

for (b=r+1;b<=c;b++)
{
StoreArray[b][c]=n;
n++;
}

n--;
for (b=c;b>=r;b--)
{
StoreArray[c][b]=n;
n++;
}

for (b=c-1;b>=r+1;b--)
{
StoreArray[b][r]=n;
n++;
}

r++;
c--;

}while (n<sqr);>

if (UserNo%2!=0)
{
int mid=((UserNo/2) +1);
StoreArray[mid][mid]=Sqr;
}
// DISPLAYING

for (int a=1;a<=UserNo;a++)
{
for (int b=1;b<=UserNo;b++)
{
cout<<StoreArray[a][b]<<" | ";
}
cout<<endl;

}
return 1;
}
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
Maxwell Chen16-Mar-08 20:25
Maxwell Chen16-Mar-08 20:25 
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
Cedric Moonen16-Mar-08 21:08
Cedric Moonen16-Mar-08 21:08 
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
Himanshu Joshi16-Mar-08 22:06
Himanshu Joshi16-Mar-08 22:06 
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
CPallini16-Mar-08 22:24
mveCPallini16-Mar-08 22:24 
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
Maxwell Chen16-Mar-08 22:35
Maxwell Chen16-Mar-08 22:35 
GeneralRe: Creating a Number Spiral Matrix [VC++] Pin
Randor 17-Mar-08 4:22
professional Randor 17-Mar-08 4:22 
Generaldo{} while (0) Pin
flyingxu16-Mar-08 19:32
flyingxu16-Mar-08 19:32 
GeneralRe: do{} while (0) Pin
Maxwell Chen16-Mar-08 20:23
Maxwell Chen16-Mar-08 20:23 
GeneralRe: do{} while (0) Pin
BadKarma17-Mar-08 0:05
BadKarma17-Mar-08 0:05 
GeneralRe: do{} while (0) Pin
flyingxu17-Mar-08 15:30
flyingxu17-Mar-08 15:30 
QuestionBorland C++ Builder multiple forms problem Pin
Linardi16-Mar-08 19:29
Linardi16-Mar-08 19:29 
GeneralRe: Borland C++ Builder multiple forms problem Pin
Maxwell Chen16-Mar-08 20:30
Maxwell Chen16-Mar-08 20:30 
QuestionAbout p2p communication Pin
manish.patel16-Mar-08 19:16
manish.patel16-Mar-08 19:16 
Generalprecondition and post condition check Pin
George_George16-Mar-08 16:16
George_George16-Mar-08 16:16 
GeneralRe: precondition and post condition check Pin
Stephen Hewitt16-Mar-08 17:26
Stephen Hewitt16-Mar-08 17:26 
GeneralRe: precondition and post condition check Pin
George_George16-Mar-08 19:48
George_George16-Mar-08 19:48 
GeneralRe: precondition and post condition check Pin
Stephen Hewitt16-Mar-08 19:57
Stephen Hewitt16-Mar-08 19:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.