25 Topics
| |
Preconditions: Addresses of 2 integer variables are on the stack as the parameters. Sample c call: swap( &num1, &num2); You must implement the following C swap function: /* Swaps the two values pointed to by x_ptr and y_ptr. */ void swap (int *x_ptr, int *y_ptr) { if (x_ptr != y_ptr) … | |
I thought I'm done doing mg activity, but my professor said that we need to use a Temporary Variable for Swapping and I have no idea where to put it. Mind giving me a hand, please? :( Here is his activity: Activity: Swapping Create a program that accepts a 10-element … | |
Hi evryone! :) I'm a complete beginner in Java and today i'm found my self stack while trying to solve a problem. Basically what i have to do is to write a program that sorts three integers. The integers are entered from the input dialogs and stored in variables num1, … | |
This shows the code for one simple crypt of text by swapping two adjoining characters each. You can make that more complex if you like. Can also be used for one nice riddle. | |
As for my assignment I had to write a program to swap 2 digit number Example:- If user input 12 the swaped number Would be 21. Along with ALgorithm, and a short description on this program(As how will you solve this program or what measure you'll take to get desired … | |
Hi guys, I got this from my teacher and im really confused. could anyone point me in the right direction? Thanks > What does it do? > > This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle: > "This function ..........., … | |
Hey everyone, I'm new to the concept of stacks and queues. I think I have the basics, but I have a quick question. If I am wanting to swap an object, say x, for another object, say y, in a stack or a queue, is this possible without introducing an … | |
Given two integers A & B. Determine how many bits required to convert A to B. Write a function int BitSwapReqd(int A, int B); Please first define the logic to calculate the number of bits required to convert A to B and then code. Thankx a lot. | |
struct looks like this: [CODE] struct ListNode; typedef ListNode* ListType; struct details { char first_name[20]; char last_name[20]; int start_number; int end_number; }; struct ListNode { details data; ListType next; }; ListType list = NULL; ListType head = NULL; ListType * PointerToHead = &head; [/CODE] I have a circular linked list … | |
First question here, so bear with me. I have been trying to create a view on a QMainWindow using a QDeclarativeView as the canvas, but whenever I try to switch the source of the QDeclarativeView my program segfaults and I frankly have no idea why, or how to fix it. … | |
I've a vector of size 'n', I need to do random couples with the n numbers (integers) and make a swap between them. Any ideas how? I had this idea [CODE] int low = 0; int temp; for (int high = n-1; i= low; high-- ) { temp = v[high]; … | |
Hi folks, [CODE] int a=10,b=5,tmp; tmp=a; a=b; b=tmp; [/CODE] This is ordinary swap. I want to do this swap to the structure variables. And how to free the memory of tmp structure variable after swapping. | |
Hello everyone first of all thanks to daniweb and all users to help me lots of time. now come to problem i am learning java from last one month today i wrote a program to swap two objects it is running but not performing desired task. all instance fields are … | |
Hi All, A few years ago the general rule of thumb for swapping was swap=RAMx2. Now that seems fairly sensible when ram was smaller than it is today. My new rig arrives tomorrow and with 8gig of ram following the rule of thumb above would mean 16Gig of swap space. … | |
Dear Colls, I have an onmouse over problem. I need to swap JPG with HTML OR to swap JPG with marquee text (moving text in left direction). OR to swap Text with Marquee. I have spend almost half day to do it, without success. Could you help? Thank you in … | |
The following code swaps values between 2 variables without using a temp variable..... i want to know the logic behind this [CODE] //#include "stdafx.h" #include<stdio.h> int main(){ int a =3, b=5; a^=b^=a^=b; printf("%d" "\n" "%d",a,b); return 0; }[/CODE] [CODE]Output 5 3 [/CODE] | |
I have 4 512 DDR2 pc3200 ecc and 4 512 DDR2 pc3200 non ecc that I want to swap for 2 2 Go DDR1 pc 3200 contact me asap on 07916714525 in london | |
Hi everyone. I am trying to figure out if it's possible to write a PHP or JavaScript that changes the background image every time the browser refresh button (or F5) is pressed. I haven't seen it done this way, however I have seen it done for banners and other images. … | |
Well i have the following program where i need to swap students(dynamically created structure array) . Just cant seem to get the swap right. Main problem's here : [code=c] struct student *stemp; stemp=(struct student *)malloc(sizeof(student)); *stemp.name=s[i].name; s[i].name=s[j].name; s[j].name=stemp->name; [/code] Other info : [code=c] where s[i] belongs to a dynamically created … | |
During runtime when a program asks for a memory block (say, by malloc()), its provided with a block of virtual addresses, say 0x10000000 to 0x1000A00 (for 32 bit). During the execution, other processes are incorporated into the main memory and pages 0x10000000-0x100000A0 are paged out. After some time, the program … | |
Hi everyone.. I am a new programmer to OpenGL using C++. I have an nxn grid having numbers in each cell of the grid.. I have to swap the content of two cells.. ie., the numbers in 2 cells selected, have to be swapped. I am not knowing how to … | |
[B]MyClass.h[/B][CODE]class MyClass { //... public: template <class T> static void Swap(T& Var1, T& Var2); //... }[/CODE] [B]MyClass.cpp[/B][CODE]template <class T> void MyClass::Swap( T& Var1, T& Var2 ) { Var1 ^= Var2; Var2 ^= Var1; Var1 ^= Var2; }[/CODE] In another file[CODE]#include "MyClass.h" //... int n = 40; int m = 60; … | |
this is my code for a simple link list...i cant solve the problem of the while loop.it is only working for "1".and i cant swap two nodes in the list and cant insert nodes in a given position...how can i do those???plz help....[CODE]//Pirateā¢ #include<stdio.h> #include<string.h> #include<stdlib.h> struct list_element { char … | |
Hi, Trying to add a swap file to my server as below: [code] dd if=/dev/zero of=/swapfile1 bs=1M count=2048 2048+0 records in 2048+0 records out 2147483648 bytes (2.1 GB) copied, 27.4514 seconds, 78.2 MB/s [root@clearab2 /]# mkswap -c /swapfile1 Setting up swapspace version 1, size = 2147479 kB [root@clearab2 /]# swapon … | |
I would like to know how can the swapping function be implemented using pointers, void swap (int*, int*) [CODE] //function prototypes void swap(int& a, int& b); //function (passing by ref) void swap(int& a, int& b) { int t = a; a = b; b = t; }[/CODE] Is this correct? … |
The End.