thanks I fixed it now it works
int temp[10];
Type: Posts; User: gqchynaboy
thanks I fixed it now it works
int temp[10];
#include <iostream>
using namespace std;
void mergeSort(int a[], int low, int high);
void merge (int a[], int low1, int high1, int low2, int high2);
int main()
{
When I try to open a file it says it doesn't exist, but it really does though..
Reader( string fileToRead );
// To simplify the implementation, the user may either call "getLine" but
//...
^^ Not really, I'll try to figure out with the code you tried to help me, its giving me a seg fault @ return sum(a, b, b+half) + sum(a, b+half+1, e);
^^ Well you know more then me, thanks for the help =]
int sum (int a[], int b, int e)
{
if ( b == e) // assuming no # repeat
return a[0];
int n = (e-b)+1; // couldn't you just put "int n = b" ?
int half = n / 2;
return sum(a, b,...
This code segment sums up using recursive
int sum(int a[], int n)
{
if (n==0)
return 0;
int sumSoFar = sum(a, n-1)
I need to Sum up an array using Recursion however, I need to do 2 recursions. Sum off the first half then the second half then add them together and them add the middle to get the sum.
does...
No need for attitude, like i said im working in Assembly Langauge and I guess the NOT operator works differently.
!0000 0010 = 0000 0000
!0000 0000 = 0000 0001
! non-zero = 0
! 0 = 1
One thing I dont understand how the NOT operator can turn a 2 into 0 then using the NOT again it turns the 0 into 1.
...
Oppz i added instead of and..thx man!!!
So it would go something like this
i would have b be an int though
b = 1111 1111
(1111 1111 & 1) = 0000 0000
!(0000 0000) = F F
!(0000 0000) = 0 0
I want simplicity =]
What does the !! mean? And is this for 128 bits? and if i wanted 8 bits I would use
return (!!(b& 1))+(!!(b& 2))+(!!(b& 4))+(!!(b& 8)))
Sorry but I dont think it will work, I forgot to mention I need to count 8-bits :(
I'm having a trouble of thinking of way to count the number of 1 bits in a binary number with out using any condition tests or branches. Only ones i know have condition tests or branches like
...
Nevermind got it to work
I can only get it to print out numbers 10-15
if(base =='h')
{
int temp = x, quotient, remainder;
Any other ideas? I couldn't get it to implement..
Where not allowed to use sprintf or any other libraries just writeStr.
I can't use printf, but writeStr so when i use writeStr("Decimal is %d", x); there are to many arguements of course
#include <unistd.h>
#include "writeStr.h"
int writeStr(char *theString)...
http://www.cs.sonoma.edu/~stauffer/250S05/ProgProjects/250S05.Project1.html
"intToStr.c - This function takes three arguments, an unsigned int, the address of a char array, and a char indicating...
I just created my own Power function ...
we can't use scanf and printf......that is why we have to convert it ourselfs
How can I make this line work without using the pow function?
multiplier = (int)pow((double)10,(double)((length - 1) - i));