|
So you mind a lot...huh. I think you don't know anything at all..
|
|
|
|
|
You're the one who cannot do a simple homework question, we are mostly professional developers here - clearly you are not, maybe you should stick to an easier profession if you cannot do your own homework, maybe be a cleaner or something better suited to you skills (or lack of them).
We are more than happy to help those that at least try to solve the problem themselves, not completely lazy people like you.
Darka [ Xanya]
"When you're taught to love everyone, to love your enemies, then what value does that place on love?"
|
|
|
|
|
how do i get the system time as nanosecond?
|
|
|
|
|
I want to make a one second while loop but the resolution of the time must be very high (nanosecond). Thanks
|
|
|
|
|
I'm not sure how you get the time in nanoseconds of the top of my head, but you might be able to do what you want to do with a timer function.
|
|
|
|
|
Bob X wrote: you might be able to do what you want to do with a timer function
no chance (if you mean windows WM_TIMER) as it is not high enough resolution, QueryPerformanceCounter() is better but I don't think you will ever get a one nanosecond loop as WIndows is not a realtime operating system.
See here:
http://msdn.microsoft.com/msdnmag/issues/04/03/HighResolutionTimer/[^]
Why do you need such accuracy anyway?
|
|
|
|
|
I am most intrigued by an application that requires an event to occur every second but to 1 billionth of a second accuracy, please tell us more...
If you need +/- 1ns accuracy then because the windows OS family are not real time operating systems this will not be acheivable, perhaps +/- 10ns but realistically +/- 100ns should be assumed.
If this is not adequate, then in order to measure to 1ns with an acceptable error then you actually need sub nanosecond timing solutions. Have you calculated what level of error you can tolerate in the application to which this problem pertains?
|
|
|
|
|
Hello,
Can anyone tell me how to run C programs in Turbo C++ IDE ?
|
|
|
|
|
|
Hi,
I have written followng linked program using doubly linked list and the errors are:
1-> code has no effect.
2-> unreachable code.
3-> statement missing.
and the code is are as follow
#include
#include
create(int);
add_atbeg (int);
add_after (int ,int);
del();
display();
count();
rev();
struct node
{
struct node *left;
int data;
int *tmp;
struct node *right;
}*start;
main()
{
int ch,n,m,po,i;
start=NULL;
printf("\n1 :create list");
printf("\n2:add at begining");
printf("\n3:add after");
printf("\n4:delete");
printf("\n5:display");
printf("\n6:count");
printf("\n7:reverse");
printf("\n8:quit");
while(1)
{
printf("enter choice\t");
scanf("%d",&ch);
switch(ch)
{
case 1:printf("how many nodes you want\t");
scanf("%d",&n);
for(i=0;i {
printf("enter the element%d\t",i+1);
scanf("%d",&m);
create(m)
{
break;
case 2:printf("enter the element\t");
scanf("%d",&m);
add at beg (m);
break;
case 3:printf("enter the element\t");
scanf("%d",&m);
printf("enter the position after which element\t");
scanf("%d",&po);
add_after (m,po);
break;
case 4:printf("enter the element for deletion\t");
scanf("%d",&m);
break;
case 5:display(); break;
case 6:count(); break;
case 7:rev(); break;
case 8:exit();
default :printf("wrong choice");
}
}
}
}
create(int num)
{
struct node *q,*tmp;
tmp=malloc(size of(struct node));
tmp->data=NULL;
tmp->right=NULL;
if(start==NULL)
{
tmp->=NULL;
start->right=tmp;
start=tmp;
}
else
{
q=start;
while(q->right!=NULL)
q=q->right;
q=right=tmp;
tmp->left=q;
}
add_beg (int num)
{
struct node *tmp;
tmp=malloc(size of(struct node));
tmp->=NULL;
tmp->data=num;
tmp->right=start;
start->left=tmp;
start=tmp;
}
add_after(int num,int c)
{
struct node *tmp,*q;
int i;
q=start;
for(i=0;i {
q=q->right;
if (q==NULL)
{
printf("therre are less than %d elements\n");
return;
}
}
tmp=malloc(size of(struct node));
tmp->data=num;
q->right->left=tmp;
tmp->right=q=right;
tmp->left=q;
q->right=tmp;
}
del(int num)
{
struct node *tmp,*q;
if(start->data==num)
{
tmp=start;
start=start->right;
start->left=NULL;
free(tmp);
return;
}
q=start;
while(q->right->data==num)
{
tmp=q->right;
q->right=tmp->right;
tmp->right->left=q;
free(tmp);
return;
}
q=q->right;
}
if(q->right->data==num)
tmp=q->right;
free(tmp);
q->right=NULL;
return;
}
printf("element %d not found\n",num);
}
display()
{
struct node *q;
if(start==NULL)
{
printf("list is empty\n");
return;
}
q=start;
printf("list is\n\n");
while(q!=NULL)
{
printf("%d",1->data);
q=q->right;
}
printf("\n");
}
count()
{
struct node *q=start;
int cnt=0;
while(q!=NULL)
{
q=q->right;
cnt++;
}
printf("number of elements are %d\n",cnt);
}
rev()
{
struct node *p1,p2;
p1=start;
p2=p1->right;
p1->=NULL;
p1->left=p2;
while(p2!=NULL)
{
p2->left=p2->right;
p2->right=p1;
p1=p2;
p2=p2->right;
}
start=p1;
}
}}
arun
arun
|
|
|
|
|
I tried system("c:\\....exe") and ShellExecute("c:\....exe") but both of them shows a black DOS box.. I want do launch the program directly
|
|
|
|
|
|
I have Visual C++, Version 6.0. Old, I know, but I will purchase a new one based on what I learn about its ability for polymorphic overloading of operators.
I want to overload operators in a polymorphic fashion. The idea is to be able to create a sort of algebra of geometric objects. So, for example, I can easily overload vector operators for vector addition by overloading the + operator for that particular class, and the code will look like mathematical notation.
If however I want to overload operators for a class of objects, I must use a messy construction, depending on dereferencing pointers. The notation doesn't look quite like textbook notation.
This is because Microsoft C++ does polymorphism through pointers, not through the objects themselves.
I will explain by example:
I have two classes of objects: spline and cube. Both are based on class geom. I also have a matrix class. Code snippets follow:
class geom : public CObject {
public:
geom();
virtual ~geom();
DECLARE_SERIAL(geom);
void Serialize(CArchive& ar);
geom(geom&);
void operator=(geom& obj);
virtual geom operator *(matrix); // Right product by matrix
virtual geom operator*=(matrix&); // Right product by matrix
}; // class geom
class cube : public geom {
public:
cube();
virtual ~cube();
DECLARE_SERIAL(cube);
void Serialize(CArchive& ar);
geom operator *(matrix); // Right product by matrix
geom operator*=(matrix&); // Right product by matrix
// A cube has some vectors in it, which can be transformed by operator *
// overloaded for matrix multiplication
}; // class cube
class spline : public geom {
public:
spline ();
virtual ~ spline ();
geom operator *(matrix); // Right product by matrix
geom operator*=(matrix&); // Right product by matrix
// A spline has some vectors in it, which can be transformed by operator *
// overloaded for matrix multiplication
}; // class spline
I want to use matrix multiplication thusly:
spline sp;
spline sp_transformed;
cube cu;
cube cu_transformed;
matrix xformer;
sp_transformed= sp * xformer; // Comes out not really a spline- only a geom.
cu_transformed= cu * xformer; // Comes out not really a cube- only a geom.
What comes out is just the geom part. No amount of doodling with
geom(geom&);
void operator=(geom& obj);
will help.
However, if I use pointers, as follows, this works. But it is clumsy, and I also have to
worry about deleting the intermediate products:
class geom : public CObject {
public:
geom();
virtual ~geom();
DECLARE_SERIAL(geom);
void Serialize(CArchive& ar);
geom(geom&);
void operator=(geom& obj);
virtual geom *operator *(matrix); // Right product by matrix
virtual geom *operator*=(matrix&); // Right product by matrix
}; // class geom
class cube : public geom {
public:
cube();
virtual ~cube();
DECLARE_SERIAL(cube);
void Serialize(CArchive& ar);
geom *operator *(matrix); // Right product by matrix
geom *operator*=(matrix&); // Right product by matrix
// A cube has some vectors in it, which can be transformed by operator *
// overloaded for matrix multiplication
}; // class cube
class spline : public geom {
public:
spline ();
virtual ~ spline ();
geom *operator *(matrix); // Right product by matrix
geom *operator*=(matrix&); // Right product by matrix
// A spline has some vectors in it, which can be transformed by operator *
// overloaded for matrix multiplication
}; // class spline
spline sp;
spline sp_transformed;
cube cu;
cube cu_transformed;
matrix xformer;
sp_transformed= *(sp * xformer); // Messy
cu_transformed= *(cu * xformer); // Messy
So, my question is, does anybody know of a C++ implementation which supports the first kind of polymorphic overloading, which I might call "puristic"?
|
|
|
|
|
I'm currently in the process of writing an assembly, and I'm trying to test some of the code that I wrote. I'm wondering if it's possible to debug the code inside the assembly. Does anyone know if I can do this? If so, is there any documentation on this?
Cheers!
Kevin
|
|
|
|
|
I may be missing something, but...
run it under the debugger using either the mixed mode or managed debugger.
|
|
|
|
|
Hello friends,
I have a file containing:
1499,0508,00747522,13:56:22.289248,13:56:23.232780,50182289248,50183232780,-943532
600 lines like this
I declared a structure like this
struct data{
int c1;
int c2;
long int c3;
char c4[15];
char c5[15];
long double c6;
long double c7;
int c8;};
and in the main program
FILE *fp=NULL;
int i=0,j=0,k=0;
char c=NULL,cc=NULL;
fp = fopen("res.txt","r");
for(i=0;i<601;i++)
fscanf(fp,"%d, %d, %ld,",&c1,&c2,&c3);
for(j=0;j<15;j++){
fscanf(fp,"%c,",&c);
c4[j]=c;}
for(k=0;k<15;k++){
fscanf(fp,"%c,",&cc);
c5[k]=cc;}
fscanf(fp,"%E,",&c6);
fscanf(fp,"%E,",&c7);
fscanf(fp,"%d\n",&c8);
and when i tried to print cdata[i].c4,c5,c6,c7,c8 etc for some i value...Im getting garbage value...
Can anyone of you help me?
how to tackle that c4 and c5?
is it right to take long double for c6,c7?
thanx in advance...
Regards
|
|
|
|
|
I need to send data with using serial port. and i found AxMSComm can u explain what is AxMSComm and how we use it.
-------------------------------------------------------
haven`t sign yet
|
|
|
|
|
|
Thanks for the link. actually VS .Net 2003 beta doesn`t find
#using <axmscommlib.dll>
#using <mscommlib.dll>
using namespace AxMSCommLib;
using namespace MSCommLib;
unless i drag the AxMSComm from "Microsoft Communications Control" from toolbox menu
when i drag it
this->axMSComm1->Handshaking = HandshakingConstants::NoHandshaking; // no handshake is used
It doesnt find NoHandshaking function
what is the reason that VS 2003 .Net compiler doesn`t find that functions.
thanks!!
|
|
|
|
|
Hi there,
I have a strange thing happening with calloc/malloc. Here is my code:
...
double *a = (double*)malloc(Na*sizeof(double));
double *b = (double*)malloc(Nb*sizeof(double));
double *c = (double*)malloc(Nc*sizeof(double));
...
The problem is that the two pointers b and c point toward the same address. Anyone aware of this problem and how to fix it?? (I'm working under .NET2003)
Thanks a lot.
|
|
|
|
|
|
Yes, sorry for disturbance. Would that be in the Visual C++/MFC forum?
|
|
|
|
|
|
Hello...
I have a function called:
MyFunction(LPCVOID lpBuffer)
{
}
But my parameter is a String*, for example:
String* s = "Hello World";
Are there any possibilities to cast String* to LPCVOID ?
|
|
|
|
|
|