|
You shuold use try, catch and throw and not the depracated __try or TRY etc.
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi,
I have 2 questions here. Need your help . Thanking in advance.
Question1:
Write an application that prints the following diamond shape. You may use output statements that prints a single asterisks ( * ) , a single space or a single newline character . Maximize your use of repetition (with nested For structures)
and minimize the number of output statements . The desired output should be as below :
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
Question2:
Modify the program you wrote in Question 1 to read odd number in the range 1 to 19 to specify the number of rows in the diamond . Your program should then display a diamond of the appropriate size .
regards
|
|
|
|
|
Uh oh! I sense trouble!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
The CP community will be glad to help you have a specific question about this. But we'd be doing you a disservice if we simply gave you the solutions to these problems.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
what do you want? to print the diamond shape? if so use following code..
for(int i=0;i<10;i++)<br />
{<br />
if(i%2==1)<br />
for(int j=0;j<i;j++)<br />
cout<<"* ";<br />
cout<<endl;<br />
}<br />
for(int k = 10;k>0;k--)<br />
{<br />
if(k%2 == 1)<br />
for(int j=k;j>0;j--)<br />
cout<<"* ";<br />
cout<<endl;<br />
} <br />
|
|
|
|
|
i think u need it in c++
include Header files here
void main()
{
int nTotal,nCOunt;
cout<<"How much rows ?";cin>>nTotal;
while(!(nTotal%2))
{
cout<<"Enter Odd No :";
cin>>nTotal;
}
int i,j,k,l;
for(i=1;i<=nTotal;i+=2)
{
cout<<"\n"; //as u like the \n here hahah..
for(j=1;j<=i;j++)
cout<<"* ";
}
for(k=(i-4);k>=1;k-=2)
{
cout<<"\n";
for(l=1;l<=k;l++)
cout<<"* ";
}
}//end main
TRY IT NOW
RENJITH
HI FRIEND I THINK I GAVE THE SOLUTION AS U ASK ...
R U SATISFIED? NEED ANY MORE HELP??
R_Renjith The True CP ian
|
|
|
|
|
You miss headers because they are like html tags.When you send the message check the Display this message as-is (no HTML) check box then you can see headers too.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
hahaah
# include<iostream.h>
#include<conio.h>
#include<time.h> hahahahaaha i i can...!!! thankz...
R_Renjith The True CP ian
|
|
|
|
|
Homework questions are OK here, but we aren't going to do your work for you. Get started on the code, and when you get stuck, ask a specific question and post your code along with it.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
i remembered that i do this title when i start study TC2.0..
.
I'm a beginner of VC++...
|
|
|
|
|
i'm so sorry to ask the silly question..
i creat empty console application.
i have one header file that contain class declaration
another one cpp file that is class definition
the last cpp file is main file.
in main.cpp, StartJob is unknown.. don't know why. in logic i think that shouldn't be
an error.
<br />
class StartJob<br />
{<br />
public:<br />
StartJob();<br />
void GetStartJob();<br />
}<br />
<br />
#include "startjob.h"<br />
<br />
StartJob::StartJob(){}<br />
StartJob::GetStartJob()<br />
{<br />
cout<<"Start job now"<br />
}<br />
<br />
#include <iostream.h><br />
#include "Startjob.cpp"<br />
#include "startjob.h"<br />
<br />
void main()<br />
{<br />
StartJob ajob;
ajob.GetStartJob();<br />
<br />
}<br />
<br />
<br />
|
|
|
|
|
You do not need to include the implementation file:
Remove:
#include "Startjob.cpp"
That file is linked during compilation. You only need the header file (#include "startjob.h")
Also, I don't know if this is a typo or not, but you need a semi-colon after your class declaration in the header file:
class StartJob
{
public:
StartJob();
void GetStartJob();
};
"There's a slew of slip 'twixt cup and lip"
|
|
|
|
|
no.. no typo and i tried several ways.. it is not like borland c++. can't create a project just like that.
i don't know why i can't create object of startjob class
evenafter i tried created the new project and call the different name, the same problem is still remain.
dont' know how to fix it.
|
|
|
|
|
Can you post the actual error you are receiving?
"There's a slew of slip 'twixt cup and lip"
|
|
|
|
|
s.cpp is a main() method
k is class name
<br />
<br />
class k<br />
{<br />
public:<br />
k(){ cout<<"hi, how are you?\n";<br />
};<br />
<br />
#include "k.h"<br />
<br />
void main()<br />
{<br />
k aclass;<br />
<br />
}<br />
<br />
s.cpp<br />
E:\s\s.cpp(8) : error C2065: 'k' : undeclared identifier<br />
E:\s\s.cpp(8) : error C2146: syntax error : missing ';' before identifier 'aclass'<br />
E:\s\s.cpp(8) : error C2065: 'aclass' : undeclared identifier<br />
Error executing cl.exe.<br />
|
|
|
|
|
//k.h
//class k
class k
{
public:
k(){ cout<<"hi, how are you?\n"; } // need closing brace
};
//s.cpp, main method
#include "k.h"
void main()
{
k aclass;
}
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
Within you lies the power for good - Use it!
|
|
|
|
|
i found it
the problem is on including a header.. i got the case problem.
#include "job.h"
#include <iostream.h>
#include <fstream.h>
#include <Afx.h> // it's <afx.h> not <Afx.h>
now everything fine.. thanks
|
|
|
|
|
i found it
the problem is on including a header.. i got the case problem.
#include "job.h"
#include < iostream.h >
#include < fstream.h >
#include < Afx.h > // it's < afx.h > not < Afx.h >
now everything fine.. thanks
|
|
|
|
|
CMyForm* prova;
prova = new CMyForm;
prova->m_edit.SetWindowText("ciao");
delete prova;
This doesn't work.
And the error is:
void CWnd::SetWindowText(LPCTSTR lpszString)
{
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
if (m_pCtrlSite == NULL)
::SetWindowText(m_hWnd, lpszString);
else
m_pCtrlSite->SetWindowText(lpszString);
}
Because as Nish said
That won't work. The edit control has not been created yet!!!
So here comes my question:
How I create an edit control on another form so that I can use functions of it from other frames?
"Nelle cose del mondo non e' il sapere ma il volere che puo'."
|
|
|
|
|
You need to call Create or CreateWindow, too. Sorry, I'm too lazy to put in the MSDN CD currently It's one of these functions.
What you are doing is creating the class with new, but not the window which is encapsulated. This requires a second step.
Martin
|
|
|
|
|
How can I understand if a drive is NTFS or FAT32 in my program?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
NTSF:
template "Boot Sector NTFS"
// Template by Paul Mullen, pcguru@the-answer.com
// last modified Jul 16, 2000
// To be applied to sector 0 of an NTFS-formatted
// logical drive or to the mirror copy of the boot
// sector, which will be located near the end of
// the partition.
// See Microsoft KB article Q153973, "Recovering NTFS boot Sector"
// http://support.microsoft.com/support/kb/articles/Q153/9/73.asp
description "Boot sector of an NTFS partition"
applies_to disk
sector-aligned
requires 0x00 "EB" // bytes 0 to 2 are
requires 0x02 "90" // JMP instruction
requires 0x03 "4E 54 46 53 20" // ID must be "NTFS"
requires 0x1FE "55 AA" // "magic" signature
begin
read-only hex 3 "JMP instruction" //00
char[8] "SystemID" //03
uint16 "Bytes per sector" //0B
uint8 "Sectors per cluster" //0D
uint16 "Reserved sectors" //0E
hex 3 "(always zero)" //10
read-only hex 2 "(unused)" //13
hex 1 "Media descriptor" //15
read-only hex 2 "(unused)" //16
uint16 "Sectors per track" //18
uint16 "Heads" //1A
uint32 "Hidden Sectors" //1C
read-only hex 4 "(unused)" //20
read-only hex 4 "(always 80 00 80 00)" //24
int64 "Total sectors" //28
move -8
hex 8 "Total sectors (hex)" //28
int64 "Start C# $MFT" //30
int64 "Start C# $MFTMirr" //38
uint32 "Clust per MFT rec" //40
uint32 "Clust per index block" //44
uint32 "Serial number (int)" //48
move -4
hex 4 "Serial number (hex)" //48
goto 0x1FE //boot load code follows
read-only hex 2 "Signature (55 AA)" //1FE
end
FAT32
template "Boot Sector FAT32"
// Template by Stefan Fleischmann
// To be applied to sector 0 of a FAT32-formatted logical drive.
description "BIOS parameter block (BPB) and more"
applies_to disk
sector-aligned
requires 0x02 "90"
requires 0x52 "46 41 54 33 32" // ="FAT32" at offset 52
requires 0x1FE "55 AA"
begin
read-only hex 3 "JMP instruction"
char[8] "OEM"
section "BIOS Parameter Block"
uint16 "Bytes per sector"
uint8 "Sectors per cluster"
uint16 "Reserved sectors"
uint8 "Number of FATs"
uint16 "Root entries (unused)"
uint16 "Sectors (on small volumes)"
hex 1 "Media descriptor (hex)"
uint16 "Sectors per FAT (small vol.)"
uint16 "Sectors per track"
uint16 "Heads"
uint32 "Hidden sectors"
uint32 "Sectors (on large volumes)"
section "FAT32 Section"
uint32 "Sectors per FAT"
uint16 "Flags"
uint16 "Version"
uint32 "Root dir 1st cluster"
uint16 "FSInfo sector"
uint16 "Backup boot sector"
read-only hex 12 "(Reserved)"
endsection
hex 1 "BIOS drive (hex, HD=8x)"
read-only uint8 (Unused)
hex 1 "Ext. boot signature (29h)"
uint32 "Volume serial number (decimal)"
move -4
hex 4 "Volume serial number (hex)"
char[11] "Volume label"
char[8] "File system"
endsection
goto 0x1FE
read-only hex 2 "Signature (55 AA)"
end
|
|
|
|
|
Whats that? I just need something like win32 functions.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
It's how an NTFS and a FAT32 partition entrance looks like.
|
|
|
|
|
Thank you.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|