473,417 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,417 software developers and data experts.

double-linked list elements swap

Hi!

I'm writing function which swaps two arbitrary elements
of double-linked list. References to the next element of list
must be unique or NULL (even during swap procedure), the same condition
should be kept for references to previous element of list.

Here is my solution below:

struct node {
int i;
struct node *p; /* prev */
struct node *n; /* next */
};

void swap ( struct node *a1, struct node *a2 ) {

struct node* a1p = a1->p;
struct node* a2p = a2->p;

struct node* a2n_o = a2->n;
struct node* a1n_o = a1->n;

struct node* a1n = a1->n;
struct node* a2n = a2->n;

struct node* a2p_o = a2->p;
struct node* a1p_o = a1->p;

if ( a1->n == a2 ) {
// ...->[ a1 ]->[ a2 ]->...
if ( a1p != NULL ) {
a1p->n = NULL;
}

if ( a2n != NULL ) {
a2n->p = NULL;
}

a2->n = a1;
a1->n = a2n_o;

a1->p = a2;
a2->p = a1p_o;

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

} else if ( a2->n == a1 ) {
// ...->[ a2 ]->[ a1 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

a1->n = a2;
a2->n = a1n_o;

a2->p = a1;
a1->p = a2p_o;

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}
} else {
// ...->[ a1 ]->...->[ a2 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}

a1->n = NULL;
a2->n = a1n_o;
a1->n = a2n_o;

a2->p = NULL;
a1->p = a2p_o;
a2->p = a1p_o;
}

}

The question is - how to correctly test effectiveness of such implementation
to optimize it? May be some kind of visualisation to make possible to reduce
quantity of steps or something?

Thanks!
Nov 14 '05 #1
12 15052

"Eugen J. Sobchenko" <es********@gmail.com> wrote in message
news:b7**************************@posting.google.c om...
Hi!

I'm writing function which swaps two arbitrary elements
of double-linked list. References to the next element of list
must be unique or NULL (even during swap procedure), the same condition
should be kept for references to previous element of list.

Here is my solution below:

struct node {
int i;
struct node *p; /* prev */
struct node *n; /* next */
};

void swap ( struct node *a1, struct node *a2 ) {

struct node* a1p = a1->p;
struct node* a2p = a2->p;

struct node* a2n_o = a2->n;
struct node* a1n_o = a1->n;

struct node* a1n = a1->n;
struct node* a2n = a2->n;

struct node* a2p_o = a2->p;
struct node* a1p_o = a1->p;

if ( a1->n == a2 ) {
// ...->[ a1 ]->[ a2 ]->...
if ( a1p != NULL ) {
a1p->n = NULL;
}

if ( a2n != NULL ) {
a2n->p = NULL;
}

a2->n = a1;
a1->n = a2n_o;

a1->p = a2;
a2->p = a1p_o;

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

} else if ( a2->n == a1 ) {
// ...->[ a2 ]->[ a1 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

a1->n = a2;
a2->n = a1n_o;

a2->p = a1;
a1->p = a2p_o;

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}
} else {
// ...->[ a1 ]->...->[ a2 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}

a1->n = NULL;
a2->n = a1n_o;
a1->n = a2n_o;

a2->p = NULL;
a1->p = a2p_o;
a2->p = a1p_o;
}

}

The question is - how to correctly test effectiveness of such implementation to optimize it? May be some kind of visualisation to make possible to reduce quantity of steps or something?

Thanks!


Just swap the data instead of all the pointers:

void swap ( struct node *a1, struct node *a2 ) {
int temp;
temp = a1->i;
a1->i = a2->i;
a2->i = temp;
}
Nov 14 '05 #2
In article <b7**************************@posting.google.com >,
Eugen J. Sobchenko <es********@gmail.com> wrote:
Hi! I'm writing function which swaps two arbitrary elements
of double-linked list. References to the next element of list
must be unique or NULL (even during swap procedure), the same condition
should be kept for references to previous element of list.
The easy answer is:

void swap( struct node *a1, struct node *a2 ) {
int temp;

temp = a1->i;
a1->i = a2->i;
a2->i = temp;
}

more below:
Here is my solution below: struct node {
int i;
struct node *p; /* prev */
struct node *n; /* next */
}; void swap ( struct node *a1, struct node *a2 ) { struct node* a1p = a1->p;
struct node* a2p = a2->p; struct node* a2n_o = a2->n;
struct node* a1n_o = a1->n; struct node* a1n = a1->n;
struct node* a2n = a2->n; struct node* a2p_o = a2->p;
struct node* a1p_o = a1->p; if ( a1->n == a2 ) {
// ...->[ a1 ]->[ a2 ]->...
if ( a1p != NULL ) {
a1p->n = NULL;
} if ( a2n != NULL ) {
a2n->p = NULL;
} a2->n = a1;
a1->n = a2n_o; a1->p = a2;
a2->p = a1p_o; if ( a1p != NULL ) {
a1p->n = a2;
} if ( a2n != NULL ) {
a2n->p = a1;
} } else if ( a2->n == a1 ) {
// ...->[ a2 ]->[ a1 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
} if ( a1n != NULL ) {
a1n->p = NULL;
} a1->n = a2;
a2->n = a1n_o; a2->p = a1;
a1->p = a2p_o; if ( a2p != NULL ) {
a2p->n = a1;
} if ( a1n != NULL ) {
a1n->p = a2;
}
} else {
// ...->[ a1 ]->...->[ a2 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
} if ( a1n != NULL ) {
a1n->p = NULL;
} if ( a1p != NULL ) {
a1p->n = a2;
} if ( a2n != NULL ) {
a2n->p = a1;
} if ( a2p != NULL ) {
a2p->n = a1;
} if ( a1n != NULL ) {
a1n->p = a2;
} a1->n = NULL;
a2->n = a1n_o;
a1->n = a2n_o; a2->p = NULL;
a1->p = a2p_o;
a2->p = a1p_o;
} } The question is - how to correctly test effectiveness of such
implementation to optimize it? May be some kind of visualisation to
make possible to reduce quantity of steps or something?


I would suggest writing a check double linked list function to which you
pass the head and tail pointers of the linked list, and a constant array
of ints which list the order of the nodes. Then the function simply scans
the linked list starting with the head and compares each i value with the
next value off of the array, if any of the values are incorrect it then
outputs an error, and then reverses the procedure checking from the tail
to the start of the list.

Then write some code to create a list, and perform some node swaps on it
checking after each swap that the list is correct.

Your swap function looks too complicated. If I was writing it I would say
there are two main cases:
1) The two nodes to swap are next to each other,
2) The two nodes to swap are not next to each other

Then to handle the first case you need to:
1) Remove the first node to swap from the linked list
2) Insert the removed node after the second node to swap

And to handle the second case you need to:
1) Remove one of the nodes to swap from the linked list
2) Insert the removed node after the other node
3) Remove the other node from the linked list
4) Insert the removed node where the original removed node was.

Then write functions to remove a specified node from the linked list, and
to insert a node into it.

Kevin.

Nov 14 '05 #3
On 2004-11-04 01:24, Eugen J. Sobchenko wrote:
I'm writing function which swaps two arbitrary elements of
double-linked list. References to the next element of list must be
unique or NULL (even during swap procedure), the same condition should
be kept for references to previous element of list.
The constraint of keeping the references NULL or unique during the swap is
something you cannot guarantee by reordering the assignments of the pointers.
Some sort of locking must be used, which is machine-dependent and cannot be
described portably here (i.e. a mutex that protects the entire list, while
reordering operations happen).

One trick that you can use to effectively 'swap' two elements of a list is to
decouple the list linkage from the element data, using something like this:

------------------------------------------------------------------------------
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

struct nodeinfo;
struct node {
struct nodeinfo *n_info;
struct node *n_next;
struct node *n_prev;
};

struct nodeinfo {
int ni_data;
};

struct node *listhead;

struct nodeinfo info1 = { 10 };
struct nodeinfo info2 = { 20 };
struct nodeinfo info3 = { 30 };

struct node node1 = { &info1, NULL, NULL };
struct node node2 = { &info2, NULL, NULL };
struct node node3 = { &info3, NULL, NULL };

static void shownodes(struct node *_listhead);
static void swapnodes(struct node *_alpha, struct node *_beta);

int
main(void)
{
/* Link the nodes, under listhead. */
node1.n_next = &node2;
node2.n_next = &node3;
node3.n_next = &node1;
node1.n_prev = &node3;
node2.n_prev = &node1;
node3.n_prev = &node2;
listhead = &node1;

shownodes(listhead);
swapnodes(&node1, &node2);
shownodes(listhead);
return (0);
}

static void
shownodes(struct node *head)
{
struct node *np;

if (head == NULL)
return;
printf("head %p\n", head);
np = head;
do {
if (np->n_info != NULL)
printf(" node %p -> %d\n", np,
np->n_info->ni_data);
else
printf(" node %p -> null\n", np);
np = np->n_next;
} while (np != NULL && np != head);
}

static void
swapnodes(struct node *na, struct node *nb)
{
struct nodeinfo *tmp;

assert(na != NULL && nb != NULL);
tmp = na->n_info;
na->n_info = nb->n_info;
nb->n_info = tmp;
}
------------------------------------------------------------------------------

In this case, the swapping of the two nodes is simplified to the swapping of
two pointers, the n_info members of the nodes. Note though that parts of the
program cannot keep copies of `struct node' pointers around and reuse them
later. There is no guarantee that the same nodeinfo will be linked under a
pointer to a node after a while, unless the list is locked.
Here is my solution below:

struct node {
int i;
struct node *p; /* prev */
struct node *n; /* next */
};

void swap ( struct node *a1, struct node *a2 ) {

struct node* a1p = a1->p;
struct node* a2p = a2->p;

struct node* a2n_o = a2->n;
struct node* a1n_o = a1->n;

struct node* a1n = a1->n;
struct node* a2n = a2->n;

struct node* a2p_o = a2->p;
struct node* a1p_o = a1->p;

[snip]
``You're lost in a maze of twisty little passages, all alike.''
-- Nethack

Your logic seems fine, and teh way you does swapped those nodes make sense,
but the names are so confusing that it took me the better part of 15 minutes
of careful reading *WITH* a notebook by my side to find out what's going on!

IMHO C source shouldn't be so complex, unless there's a very good reason.
The question is - how to correctly test effectiveness of such implementation
to optimize it? May be some kind of visualisation to make possible to reduce
quantity of steps or something?


Sure, drawing on a whiteboard, a piece of paper or something, is certainly
going to help a lot.

- Giorgos

Nov 14 '05 #4
Eugen J. Sobchenko wrote:

Hi!

I'm writing function which swaps two arbitrary elements
of double-linked list. References to the next element of list
must be unique or NULL (even during swap procedure), the same condition
should be kept for references to previous element of list.

Here is my solution below:

struct node {
int i;
struct node *p; /* prev */
struct node *n; /* next */
};

void swap ( struct node *a1, struct node *a2 ) {

struct node* a1p = a1->p;
struct node* a2p = a2->p;

struct node* a2n_o = a2->n;
struct node* a1n_o = a1->n;

struct node* a1n = a1->n;
struct node* a2n = a2->n;

struct node* a2p_o = a2->p;
struct node* a1p_o = a1->p;

if ( a1->n == a2 ) {
// ...->[ a1 ]->[ a2 ]->...
if ( a1p != NULL ) {
a1p->n = NULL;
}

if ( a2n != NULL ) {
a2n->p = NULL;
}

a2->n = a1;
a1->n = a2n_o;

a1->p = a2;
a2->p = a1p_o;

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

} else if ( a2->n == a1 ) {
// ...->[ a2 ]->[ a1 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

a1->n = a2;
a2->n = a1n_o;

a2->p = a1;
a1->p = a2p_o;

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}
} else {
// ...->[ a1 ]->...->[ a2 ]->...
if ( a2p != NULL ) {
a2p->n = NULL;
}

if ( a1n != NULL ) {
a1n->p = NULL;
}

if ( a1p != NULL ) {
a1p->n = a2;
}

if ( a2n != NULL ) {
a2n->p = a1;
}

if ( a2p != NULL ) {
a2p->n = a1;
}

if ( a1n != NULL ) {
a1n->p = a2;
}

a1->n = NULL;
a2->n = a1n_o;
a1->n = a2n_o;

a2->p = NULL;
a1->p = a2p_o;
a2->p = a1p_o;
}

}

The question is - how to correctly test effectiveness
of such implementation to optimize it?
May be some kind of visualisation to make possible to reduce
quantity of steps or something?


If you swap the head of the list with another node,
then it might be simpler to return the address of the new head.

list = swap(list, list -> next);
l_print(list);
list = swap(list -> next, list);
l_print(list);
vs.
swap(list -> next, list -> next -> next);
l_print(list);
struct node *swap(struct node *a1, struct node *a2)
{
struct node *temp;

temp = a1 -> next;
a1 -> next = a2 -> next;
a2 -> next = temp;
if (a1 -> next != NULL) {
a1 -> next -> prev = a1;
}
if (a2 -> next != NULL) {
a2 -> next -> prev = a2;
}
temp = a1 -> prev;
a1 -> prev = a2 -> prev;
a2 -> prev = temp;
if (a1 -> prev != NULL) {
a1 -> prev -> next = a1;
}
if (a2 -> prev != NULL) {
a2 -> prev -> next = a2;
return a1;
} else {
return a2;
}
}

I modified the program in the below refered to post, to test it.
http://groups.google.com/groups?selm...mindspring.com

--
pete
Nov 14 '05 #5
Giorgos Keramidas <ke******@ceid.upatras.gr> wrote in message news:<20041104152619.T6871@orion>...

The constraint of keeping the references NULL or unique during the swap is
something you cannot guarantee by reordering the assignments of the pointers.
Some sort of locking must be used, which is machine-dependent and cannot be
described portably here (i.e. a mutex that protects the entire list, while
reordering operations happen).
I've omited this in my previous post. Of course I'm using mutex'es for
locking.

One trick that you can use to effectively 'swap' two elements of a list is to
decouple the list linkage from the element data, using something like this:

[ cut ]

static void
swapnodes(struct node *na, struct node *nb)
{
struct nodeinfo *tmp;

assert(na != NULL && nb != NULL);
tmp = na->n_info;
na->n_info = nb->n_info;
nb->n_info = tmp;
}

Good solution. But what should we do when
we have more then one information field ( e.g. 20 )?

[ cut ]
Your logic seems fine, and teh way you does swapped those nodes make sense,
but the names are so confusing that it took me the better part of 15 minutes
of careful reading *WITH* a notebook by my side to find out what's going on!

IMHO C source shouldn't be so complex, unless there's a very good reason.
You right. My fault.
The question is - how to correctly test effectiveness of such implementation
to optimize it? May be some kind of visualisation to make possible to reduce
quantity of steps or something?
Sure, drawing on a whiteboard, a piece of paper or something, is certainly
going to help a lot.


I've tried a lot but found nothing except simply draw double linked list schemas
and move links between elements on it. ;-)

- Giorgos

Nov 14 '05 #6
> Just swap the data instead of all the pointers:

void swap ( struct node *a1, struct node *a2 ) {
int temp;
temp = a1->i;
a1->i = a2->i;
a2->i = temp;
}


Good. But what should I do when I have tens of informational
fields?
Nov 14 '05 #7
> If you swap the head of the list with another node,
then it might be simpler to return the address of the new head.

list = swap(list, list -> next);
l_print(list);
list = swap(list -> next, list);
l_print(list);
vs.
swap(list -> next, list -> next -> next);
l_print(list);
struct node *swap(struct node *a1, struct node *a2)
{
struct node *temp;

temp = a1 -> next;
a1 -> next = a2 -> next;
a2 -> next = temp;
if (a1 -> next != NULL) {
a1 -> next -> prev = a1;
}
if (a2 -> next != NULL) {
a2 -> next -> prev = a2;
}
temp = a1 -> prev;
a1 -> prev = a2 -> prev;
a2 -> prev = temp;
if (a1 -> prev != NULL) {
a1 -> prev -> next = a1;
}
if (a2 -> prev != NULL) {
a2 -> prev -> next = a2;
return a1;
} else {
return a2;
}
}

I modified the program in the below refered to post, to test it.
http://groups.google.com/groups?selm...mindspring.com


Thanks. But I'm swapping two arbitrary elements of very long
double linked list. This one seems to be very slow for me. ;-(
Nov 14 '05 #8
es********@gmail.com (Eugen J. Sobchenko) writes:
Giorgos Keramidas <ke******@ceid.upatras.gr> wrote
in message news:<20041104152619.T6871@orion>...

static void
swapnodes(struct node *na, struct node *nb)
{
struct nodeinfo *tmp;

assert(na != NULL && nb != NULL);
tmp = na->n_info;
na->n_info = nb->n_info;
nb->n_info = tmp;
}


Good solution. But what should we do when
we have more then one information field ( e.g. 20 )?


You can use structure assignment with a temporary struct, instead of a
pointer, which can waste a bit of space on the stack of the program for
the allocation of an automatic struct.

You can redesign the structures, so that n_info is the *only*
information a node struct keeps, and make sure all the fields you
consider 'attributes' of the node are fields of nodeinfo.

Nov 14 '05 #9

"Eugen J. Sobchenko" <es********@gmail.com> wrote in message
news:b7*************************@posting.google.co m...
Just swap the data instead of all the pointers:

void swap ( struct node *a1, struct node *a2 ) {
int temp;
temp = a1->i;
a1->i = a2->i;
a2->i = temp;
}


Good. But what should I do when I have tens of informational
fields?


Then I would question the design. You can allocate a struct to encapsulate
all your data, and then just swap those struct pointers. For example:

struct data {
/* your fields of data */
}

struct node {
struct data* i;
struct node* p;
struct node* n;
}

void swap ( struct node *a1, struct node *a2 ) {
struct data* temp;
temp = a1->i;
a1->i = a2->i;
a2->i = temp;
}
Nov 14 '05 #10
Eugen J. Sobchenko wrote:
If you swap the head of the list with another node,
then it might be simpler to return the address of the new head.

list = swap(list, list -> next);
l_print(list);
list = swap(list -> next, list);
l_print(list);
vs.
swap(list -> next, list -> next -> next);
l_print(list);
struct node *swap(struct node *a1, struct node *a2)
{
struct node *temp;

temp = a1 -> next;
a1 -> next = a2 -> next;
a2 -> next = temp;
if (a1 -> next != NULL) {
a1 -> next -> prev = a1;
}
if (a2 -> next != NULL) {
a2 -> next -> prev = a2;
}
temp = a1 -> prev;
a1 -> prev = a2 -> prev;
a2 -> prev = temp;
if (a1 -> prev != NULL) {
a1 -> prev -> next = a1;
}
if (a2 -> prev != NULL) {
a2 -> prev -> next = a2;
return a1;
} else {
return a2;
}
}

I modified the program in the below refered to post, to test it.
http://groups.google.com/groups?selm...mindspring.com


Thanks. But I'm swapping two arbitrary elements of very long
double linked list. This one seems to be very slow for me. ;-(


I don't understand what you mean.
What's too slow?

--
pete
Nov 14 '05 #11
pete wrote:

Eugen J. Sobchenko wrote:

struct node *swap(struct node *a1, struct node *a2)
Thanks. But I'm swapping two arbitrary elements of very long
double linked list. This one seems to be very slow for me. ;-(


This is what the job comes down to:
1 swap the values of the prev pointers in a1 and a2
2 swap the values of the next pointers in a1 and a2
3 change a1 -> prev -> next, to a1
4 change a1 -> next -> prev, to a1
5 change a2 -> prev -> next, to a2
6 change a2 -> next -> prev, to a2

Obviously if any of the a->prev or a->next pointers are NULL
then some of steps 3 through 6 must be omitted.

If the head of the list is swapped,
then you need to accommodate that somehow.

Unless you just want to swap your int type data
as shown in your example,
swapping double linked nodes doesn't get any simpler than that.

--
pete
Nov 14 '05 #12
"Eugen J. Sobchenko" wrote:
.... snip ...
Thanks. But I'm swapping two arbitrary elements of very long
double linked list. This one seems to be very slow for me. ;-(


I think you are all missing a critical point. We can all see very
easily how to swap pointers when the nodes are in the middle of the
list, the complications come about when one or both of the swapees
are at the ends.

So you just eliminate the ends, and use a dummy node both for list
access and to signal the list ends. From that node you can either
go forward to the list beginning, or backward to the list end, and
its value is known and can be detected by testing equality of
pointers (which is always possible).

So you work with something like:

struct node {
struct node *next;
struct node *prev;
somedata_t thedata;
}
....
struct node listroot;
#define nil &listroot
....
nil->next = nil; nil->prev = nil;
.... build the list ....

now nil.next and nil.prev will always point to the head and tail of
the list. root is not dynamically assigned storage (i.e. not
malloc'd). Now the swapping of nodes is always the same, as long
as the swapee itself is not nil. The swapping code doesn't have to
know about nil or NULL. However list walkers have to know where
the root lies, to detect list ends by a pointer to root (i.e. nil).

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!

Nov 14 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Sydex | last post by:
When I compile code I get error C2664: 'Integration::qgaus' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(double)' in this part : double Integration::quad2d(double...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
10
by: Robert Palma | last post by:
I'm having trouble figuring out how to pass a pointer to a double array (1 dimensional) to a C function. Declaring array as: double xx; Declaring func. int process( double *input ) Calling...
10
by: Bryan Parkoff | last post by:
The guideline says to use %f in printf() function using the keyword float and double. For example float a = 1.2345; double b = 5.166666667; printf("%.2f\n %f\n", a, b);
3
by: BlueTrin | last post by:
I am using a DLL written in C, it uses some pointers on functions, I have defined a wrapper around it in C# which uses some delegates: #region Delegates and Marshalling to call solvopt public...
67
by: lcw1964 | last post by:
This may be in the category of bush-league rudimentary, but I am quite perplexed on this and diligent Googling has not provided me with a clear straight answer--perhaps I don't know how to ask the...
1
by: JWest46088 | last post by:
I keep getting these error messages: area(double,double) in Rectangle cannot be applied to () return "Area: " + Rectangle.area() + "\tCircumference: " + Rectangle.perimeter(); ...
11
by: Ole Nielsby | last post by:
First, sorry if this is off-topic, not strictly being a C++ issue. I could not find a ng on numerics or serialization and I figure this ng is the closest I can get. Now the question: I want...
2
by: dj10fld | last post by:
I am getting a (cannot convert double to double in assignment errors) here is a part of my code #include <iostream> #include <iomanip> #include <cmath> using namespace std; #define MaxSize...
2
by: Genro | last post by:
#include<stdio.h> #include<TX/graphics.h> #include<time.h> // I need help! struct Krug{ double _x; double _y; double _skox; double _skoy; double...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.