|
ya
the program ask the user to implemnt the date mm/dd/yy with function int getDate()
and the program should outputs the with void showDate()
but this two function are public members and the ipmlemntation in .cpp file
#include "stdafx.h"
#include "Date.h"
#include <iostream>
using namespace std;
int main()
{
Date d;
cout<<"Enter the date within formam mm/dd/yy\n";
cin>>d.month>>d.day>>d.year
d.getDate();
d.showDate();
system("pause");
return 0;
}
//Date.cpp function
#include "stdafx.h"
#include "Date.h"
using namespace std;
int Date::getDate() //(int month,int day,int year)
{
return(month,day,year);
}
void Date::showDate()
{
cout<<month<<"/"<<day<<"/"<<year<<endl;
}
//HEADER FILE
#ifndef DATE_H
#define DATE_H
class Date
{
public:
int month;
int day;
int year;
int getDate();
void showDate();
};
I think my problem in the passing arguments !!?
|
|
|
|
|
dr.nokia wrote: return(month,day,year);
What is this?
dr.nokia wrote: cin>>d.month>>d.day>>d.year
Missing a semicolon.
dr.nokia wrote: d.showDate();
This statement is not doing anything useful.
dr.nokia wrote: I think my problem in the passing arguments !!?
No. Arguments are what get passed to functions/methods.
Other than the one syntax error, your code should compile and work as expected. It could be vastly improved, but that is another subject altogether.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanx Mr.Daived
i fixid the semicolon but it not working also
i will try my best and thanx alot for ur help
good luck !!
|
|
|
|
|
What about a good C++ tutorial?
BTW you really need to read this [^], before posting.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I found the opencv source of cvcamshift.cpp .I have one problem of cvCamShift function in this file.That is how it change the weidth and hength and orientation .
In cvcamshift.cp:
m00 = moments.m00;
m10 = moments.m10;
m01 = moments.m01;
mu11 = moments.mu11;
mu20 = moments.mu20;
mu02 = moments.mu02;
if( fabs(m00) < DBL_EPSILON )
EXIT;
inv_m00 = 1. / m00;
xc = cvRound( m10 * inv_m00 + windowIn.x );
yc = cvRound( m01 * inv_m00 + windowIn.y );
a = mu20 * inv_m00;
b = mu11 * inv_m00;
c = mu02 * inv_m00;
/* Calculating width & height */
square = sqrt( 4 * b * b + (a - c) * (a - c) );
/* Calculating orientation */
theta = atan2( 2 * b, a - c + square );
/* Calculating width & length of figure */
cs = cos( theta );
sn = sin( theta );
rotate_a = cs * cs * mu20 + 2 * cs * sn * mu11 + sn * sn * mu02;
rotate_c = sn * sn * mu20 - 2 * cs * sn * mu11 + cs * cs * mu02;
length = sqrt( rotate_a * inv_m00 ) * 4;
width = sqrt( rotate_c * inv_m00 ) * 4;
IN a paper:(I am sorry ,It's not clear .But if you want I can send to you.)
The orientation (θ) of the major axis and the scale of the distribution are determined by finding an equivalent rectangle that has the same moments as those measured from the 2D probability distribution image (c.f. Horn, 1986). Defining the first and second moments for x and y
ΣΣ=xyyxIxM),(220
ΣΣ=xyyxIyM),(202
ΣΣ=xyyxxyIM),(11
The first two eigenvalues (the length and width of the probability distribution) are calculated in closed form as follows. From the intermediate variables a, b and c20020cxMMa−= −=ccyxMMb00112 20002cyMMc−=
We find the orientation of the equivalent rectangle −=−cab1tan21θ
The distances l1 and l2 from the distribution centroid (the dimensions of the equivalent rectangle) are given by, 2)()(221cabcal−+++= 2)()(222cabcal−+−+=
Where the extracted parameters are independent of the overall image intensity.
Thank you .I am looking forward to your answer.
|
|
|
|
|
As far as I can understand, there is no question, in your post.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sorry,I don't understand.Do you say you can't understand me?
hello
|
|
|
|
|
Simply there is no question in your post: what did you intend to ask? Moreover could you please reformat it? As it stands, it is difficult to understand.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
|
Hy folks,
I have a little question of reading out the amount of memory that one can use for a program.
I know there exists the method filling up the memory until you get an exception, but this isn't a nice way, right?
So my question: Is there a way to read out memory specs in windows and other platforms as well?
I was just wondering if one of you can thing of a nice platform independent function or approach to calculate the amount of memory available in the system.
Also I am interested to find out the amount of processors to calculate the amount of threads for that platform.
I am sorry for the leaking of knowledge.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
modified on Tuesday, March 24, 2009 11:41 AM
|
|
|
|
|
Check out GlobalMemoryStatusEx() and the structure MEMORYSTATUSEX on MSDN.
|
|
|
|
|
Thanks.
But this is just for windows, right? Or do you thing I have to check the op system before doing something. If that is possible.
I am also interested in reading out the sys specs in general. For example the amount of processors to calculate how many threads I could start..
But thanks for pointing me in a direction.
Cheers.
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
|
Thanks you very much.
But still either I am blind or just not seeing it, I can not find a nice function or a set of functions that return me system information.
Actually, if I am allow to keep you busy, I am lacking of knowledge to detecting on which op I am on.
I mean if I can detect what Os I am facing, it is straight forward to use your suggestion for windows and in Linux, I think, the specs are written in a file.
Macs fights for their owns.
But thanks for the great answers.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
Fatbuddha 1 wrote: But still either I am blind or just not seeing it, I can not find a nice function or a set of functions that return me system information.
Well, you have to read the articles and look at the code.
Fatbuddha 1 wrote: I am lacking of knowledge to detecting on which op I am on.
Do you mean which version of the OS? Like Win XP, 2000 etc.? Or Linux, MacOS, Windows?
|
|
|
|
|
Fatbuddha 1 wrote: I mean if I can detect what Os I am facing...
To my knowledge, there is not a platform-independent way of determining this. For Windows, check out GetVersionEx() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
You can't compile a program and expect it to then be copied to any computer and run. So, it's not that bad to make a function in your own code that does different things depending on which operating system it is compiled for (you may be cross compiling for all I know)
Ie:
DWORD HowManyMegaBytesDoIHave ()
{
#ifdef _WINDOWS
return ThatWindowsAPIFunction ();
#endif
#ifdef _MACOS9
etc
}
I hope that made sense. I'm pretty sure the windows one is real, no idea about the other, but they're just meant to illustrate. You'll have to the same #ifdef with the headers too.
If you want one codebase to work identically on all OS's, then you'll have to scale back your desires a long way.
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Sorry for the late answer.
Of course you are right, what was I thinking??
Spend to much time on Java .
So to conclude either your way, or I simply provide a version of my prog for win and unix. This might be even the cleaner style.
Thanks and have a nice weekend.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
Hello.
My program gets "segmentation fault" in "strcat(string,stringaux)" and it is strange because I am sure that string always has space for adding the new stringaux due to before call strcat I check if size of the destiny plus new stringaux is less than string capacity:
char string[100];
char stringaux[3];
void Function()
{
if ((strlen(string)+strlen(stringaux))<100)
{
strcat(string,stringaux)
}
}
In this way strcat() never can make string be longer than 100. But still I get SEGMENTATION DEFAULT.
I have been reading, and the explanation can be that the Stack gets full due to I have many local variables or ...
Is there anybody can tell me some ideas about why SEGMENTATION DEFAULT is produced in strcat() when I am sure that is not because there is not space in the destiny string?
Thanks in advance.
|
|
|
|
|
Are you completely sure the segfault comes from strcat? How did you determine this (setting breakpoints, putting traces in the code...)?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Because If I add a comment in the strcat() the segmentation fault does not appear and if I take the comment away the segmentation fault appears.
|
|
|
|
|
Hmm...what happens if you increate the string buffer to -let's say- 150 chars? Or increase your stringaux to -let's say- 10 chars? Does anything change? Also, before the strcat, try displaying the 2 strings to see what is in them, printf or puts should do it...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Remember that strlen returns the length without the terminating null character.
|
|
|
|
|
That is not the point!
Even if I am taking care your comment and in the example I change <100 by <99 the problem is not there.
Because as I said before I am sure that the segmentation fault is not because there is not space in the destiny, even if I make bigger the destiny [1000] I still get the segmentation fault.
|
|
|
|