- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 4
- Posts with Downvotes
- 2
- Downvoting Members
- 4
31 Posted Topics
ok so I was doing a a function that would find the square root of a number to a certain precision using newtons method and this is what I came up with /* * File: main.cpp * * * Created on July 6, 2012, 6:58 PM */ #include <iostream> #include … | |
pushl %ebp movl %esp,%ebp pushl %ebx movl 8(%ebp),%ebx leal 2(%ebx),%edx xorl %ecx,%ecx cmpl %ebx,%ecx jge .L4 .L6: leal 5(%ecx,%edx),%edx leal 3(%ecx),%eax imull %eax,%edx incl %ecx cmpl %ebx,%ecx jl .L6 .L4: movl %edx,%eax popl %ebx movl %ebp,%esp popl %ebp ret trying to make code in c then compiling it with the … | |
UniversityDatabse.h [CODE]#include<string> #include<stdexcept> #include<iostream> #include<map> #include "UniversityPerson.h" class UniversityPerson ; using namespace std ; #ifndef UNIVERSITYDATABASE_H #define UNIVERSITYDATABASE_H class UniversityDatabase { public: UniversityDatabase() ; ~UniversityDatabase() ; void print() ; void Create(UniversityPerson *p ) ; void Delete1( string name ) ; void Delete2( string id ) ; UniversityPerson *Lookup1(string id ) … | |
Im new to asembly in general and im trying to learn but i kind of not get a lot of stuff in IA32 how do I convert this: [CODE]pushl %ebp movl %esp,%ebp movl 8(%ebp),%edx movl 12(%ebp),%eax movl %ebp,%esp movl (%edx),%edx addl %edx,(%eax) movl %edx,%eax popl %ebp ret[/CODE] to C ? … | |
so i have to make a function that displays the binary representation of a 32 bit integer this is what i have [CODE]#include<stdio.h> #include<stdlib.h> #include <string.h> #include<stdio.h> void inttobin(int c) { char * s ; char * p ; size_t n = 8*sizeof(unsigned int); p = malloc(n*sizeof(char)); while (n-- > … | |
How do I define a function that reads a sequence of values from an input stream that is passed as an argument? | |
Card shuffling and dealing create a program to shuffle and deal a deck of cards,the program should consist of a clas card a class deck of cards and a driver program To deal a card, the driver just prints it out. The dealCard function does not print anything. this is … | |
if you declared/defined a virtual function for a class and redefined it in a derived class so that when you call the derived class it calls its own version of the function and not the base class function , how do you call the base class function on the definition … | |
Ok so i have to create a program that computes the convex hull of a bunch of random points but i have no idea where to start i mean i know how the program is supposed to work since you can just easily look up the pseudo code but i … | |
Re: a->variable = the variable field of the struct a points to a.variable = the variable field of the struct a | |
Re: I used a 2 d array of characters to make the board of my four in a row program made a state struct that had different fields including a brd field which was a board a 2d array then that had the configuration of every move in it and stored … | |
main.c [CODE]#include "stack.h" #include "stack_interface.h" #include "lex.h" #include <stdio.h> #include <stdlib.h> #define PUSH(s,c) if(push_char(s,c) == ERROR){ printf("Fatal error in pushing symbol on stack.\n") ; exit(1) ; } #define POP(s,c) if(pop_char(s,c) == ERROR){ printf("Fatal error in poping symbol off stack.\n") ; exit(1) ; } #define TOP(s,c) if(top_char(s,c) == ERROR){ printf("Fatal error … | |
Re: the best book for data structures in my opinion is "Data structures an advanced approach using C" by Jeffrey Esakov and Tom Weiss you could start by learning about stacks and then implementing them in a parenthesis checker program | |
Suppose there are n ducks floating on the pond in a circle. The pond is also home for an alligator with a fondness for ducks. Beginning at the 1st position, the alligator counts around the circle and eats every mth duck (the circle closing as ducks are eaten). For example, … | |
globals.h [CODE] #ifndef _globals #define _globals #define DATA( L ) ( ( L ) -> datapointer ) #define NEXT( L ) ( ( L ) -> next ) typedef enum { OK, ERROR } status ; typedef enum { FALSE = 0 , TRUE=1 } bool ; typedef void *generic_ptr … | |
Re: dont you just pass it like this int A[6][6] ; func(int A[ ][6]){ .............. } leave the first blank and specify the second? | |
radixsort.c [CODE]/**************************************************************************************/ /* Radix Sort of integers numbers using polymorphic linked lists. */ /**************************************************************************************/ #include <stdio.h> #include "list.h" #include <stdlib.h> #include "numberinterface.h" #include <math.h> void static refill( int A[] , list Bins[] ) ; int static getdigit( int number, int position ) ; int main( int argc, char *argv[] ) … | |
How do i know if two linked lists are set equal? if L1 and L2 are linked lists set equal meaning the set of values of the nodes in L1 is the same as the set of values of the nodes in L2 and order does not matter i know … | |
if i have an array of ints and an array of lists like : list Bins[10] and i initialize all the lists in the bins array to null except bins[3] and lets say Bins[3] has 1 node that has the number 8 in it how do i get that number … | |
this is what i have so fa r globals.h [CODE] #ifndef _globals #define _globals #define NEXT(L) ( (L) -> next ) #define DATA(T) ( (T) -> datapointer ) #define LEFT(T) ( (T) -> left ) #define RIGHT(T) ( (T) -> right ) typedef enum { OK, ERROR } status ; … | |
globals.h [CODE] #ifndef _globals #define _globals #define NEXT(L) ( (L) -> next ) #define DATA(T) ( (T) -> datapointer ) #define LEFT(T) ( (T) -> left ) #define RIGHT(T) ( (T) -> right ) typedef enum { OK, ERROR } status ; typedef enum { FALSE=0 , TRUE=1 } bool … | |
[CODE]i need a function that checks in two linked lists are equal thi is what i have so far bool equal(list L1 , list L2 , int (*p_cmp_f)() ){ if( L1==NULL && L2==NULL) return TRUE; else if( L1==NULL || L2==NULL) return FALSE; else if( (*p_cmp_f)(L1->data,L2->data) == -1) return FALSE; else … | |
[CODE]#include <stdio.h> #include <stdlib.h> #include "globals.h" #include "list.h" status write_int(generic_ptr p_n)){ printf(" %d " , *(int *)p_n ) ; return OK ; } int compare_int( generic_ptr x , generic_ptr y){ if( *(int*) x < *(int *)y ) return -1 ; if( *(int*) x > *(int *)y ) return 1 ; … | |
quicksort.c [CODE]#include "quicksort.h" int compare( byte *a , byte *b ) ; void memswap( byte *s, byte *t, int count ) { byte tmp ; while (count-- > 0 ){ tmp = *s ; *s++ = *t ; *t++ = tmp ; } } byte *select_pivot(byte data[], int n , … | |
I need to use mergesort to sort the data in a file that has the names and ages of 10 different people , first i have to sort the names in ascending ascii order and then i have to sort them by their age but im not sure how to … | |
ok here are the files [B]globals.h[/B] [CODE] #ifndef _globals #define _globals #define DATA( L ) ( ( L ) -> datapointer ) #define NEXT( L ) ( ( L ) -> next ) typedef enum { OK, ERROR } status ; typedef enum { FALSE = 0 , TRUE=1 } … | |
i have to impplement a dynamic stack to create a program but when i try to compile my stack.c file(with gcc) I get a bunch of errors here are my files GLOBALS.h [CODE] #ifndef _globals #define _globals #define DATA( L ) ( ( L ) -> datapointer ) #define NEXT( … | |
could someone explain to me why the compiler(gcc) outputs a warning that the control reaches the end of a non void function? [CODE] #include <stdio.h> #include "stack.h" #include "globals.h" #include "stack_interface.h" #define ERR_PUSH "Error in pushing symbol (character #%d).\n" #define ERR_POP "Error in popping symbol tp match character #%d.\n" #define … | |
trying to do a program that sums all the even numbers in the sequence but i think im doing it wrong heres my code [CODE]#include <stdio.h> int fib ( int n ); int main ( int argc, char *argv[ ] ) { int i , sum = 0 ; for(i … | |
how do i make a program that calculates the product of two vectors in C ? this is what i have but i think im doing it wrong i need some help? [CODE]#include <stdio.h> double inner(double m[ ] , double n[ ] , int size ) ; int main( int … |
The End.