huh? in my example the sequential numbers are in a set and those with next values missing are in another...
could you tell which example I did is wrong and post how it should have been done
also maybe you should be the one giving more examples
huh? in my example the sequential numbers are in a set and those with next values missing are in another...
could you tell which example I did is wrong and post how it should have been done
also maybe you should be the one giving more examples
still giving too little details for us to work here...
For the 5 marks
what is the start and end of those values?
are they values ranging from 1-n where each mark starts off where the last one ends?
if they are values how will they be given?
can they have overlapping or do each have a unique set of values?
for the border points
are they the values near the start or are they found at the end of each mark,
if so what are the range to tell if the value of the current mark is at the border points
Okay this is how I understand it
so the point is numbers whose next value is missing will always be in a set regardless of the length between these numbers
e.g.input: 0, 2, 3, 4, 5, 6
output: 0, 2-6
input: 0, 2, 4, 5, 6
output: 0-2, 4-6
input: 0, 1, 2, 9, 10
output: 0-1, 2, 9-10
input: 2, 4, 6, 9, 10
output: 2-6, 9-10
is this right?
still too little detail, post how the 5 marks and border points work
Because 7 , 10 and 11 is not in the array.
what does missing numbers have to do with intervals?
So the length is not important. The intervals will be different long.
I meant that the value of the interval is important to act as a counter on which value to store on the other array. If the interval value is unknown then the next value to store is guesswork
This code gives wrong result, but I do not know why.
we can't tackle the coding part of this until we get a clear picture on how the logic on the interval works
how is matrix initialized? are you trying to allocate a single or a 2d array
what's the value of the intervals?
I see in your example that the first set has a length of 5 but the next one only has 2 and at the last is probably for the remaining elements, is there a pattern for this?
once you know the value of the interval all you need to do is assign the value per interval to the output array
still, having problems...phew
Can't help you with just that, would ya mind posting more details
Is this suppose to be a game? 3125
Okay since ya didn't answer my question I guess it's required for you to use a matrix
Now Sorry in advance because I don't have a lot on time on my hand. I'll probably be available next week but I don't think you'd want to wait that long. So I'll give a tip in debugging the prog.
to see where in your program causes the wrong computation, try to print the matrix on every line, at each pass to the function and at each loop to pinpoint exactly where the values go wrong
are you sure you need to use matrices?
one of the answer here got it in O(log n) time with the use of arithmetic operations
http://stackoverflow.com/questions/1525521/nth-fibonacci-number-in-sublinear-time
here's some links
xfce4
linux mint
gnome or just try the terminal command on downloading the gnome-shell
Why complicate the procedure
I don't see any reason why you need to use 2d arrays for this, If you search the net on how this is done you'll see what I mean
you forgot to post the troubles your having with completing the code
like what part doesn't work or what are you supppose to do next
what's your question?
and i am using pointer 'root' in main() (as shown in code i have posted). but here i cant compare it to NULL
huh? you can compare it to NULL, the if condition in your code won't be met since you allocated memory to it... as explained before
in a bst comparing the node to null is only used to check if it is allocated successfully, I don't see a reason to force it to be NULL
cout<<root->info;
shouldn't that be printf(), this is the C forum after all
your confusing the quotient and remainder
31600000 % 60 = 526666.666666
526666.666666 is not the remainder but the quotient to the equation
try small numbers and you'll see how it works
First make sure you've installed the restricted extras package that supports popular audio and video formats such as flash and mp3, this can be found on the software center
now if you already have this, the media player I'd suggest you try is clementime, they have supposrt for external device storage such as mobile phones though I'm not sure about iPods, apologies if it doesn't work after all iTunes was born for this:)
are you sure you posted in the right forum, the code is in C++ yet this is the C forum and you forgot to post the error messages
Now in a glance, 1 error I see is you should initialize the following variables inside the structure as follows
struct node *left;
struct node *right
It terminates the function containing it,gives back control and returns a value to the calling function
also the following code is done wrong:
printf("Enter the color you want to bet\n 1 for Red\n 2 for Blue\n 3 for Green\n 4 for Yellow\n 5 for White\n 6 for Pink : ");
scanf(" %c",&cColor);
you want the user to input an integer yet your storing it in a character variable and later comparing the character variable to an integer
Theres Lots of unnecessary/uninitialized variables found in the code.
next here's the proper way of using the rand() function
/* initialize random seed: */
srand ( time(NULL) );
/* generate number ranging from 1 - 7 */
Random1 = rand() % 7 + 1;
post your code so we can see what you did,
there are 2 ways I can think of right now to do this:
the first is similar to the examples I gave you using arrays or conditions but instead of using words you's use characters
next is printing the ascii equivalent of the generated number with the scope of the starting and ending character ascii values
ex. of the latter
int generatednumber = 97;
printf("%c", generatednumber);
now with arrays it will look something similar to this:
char GuessColor[10];
char color[10][10] = {"blue", "green", "red", ...};
for(i = 0; i < strlen(color[i]); i++)
if(GeneratedNumber == i)
strcpy(GuessColor,color[i]);
printf("%s", GuessColor);
simple
by "assign" I mean it's more on conditions where a string variable color will get it's value from the generated number using if-else statements
example would look something like this:
if(numbergenerated == 1)
color = "blue";
else if(numbergenerated == 2)
color = "red";
but seriously take the array advice it's gonna lessen the code cluster
you could (well not literally assign but the use of conditions),though that's gonna be a lot of if-else statements
using an array and looping through the indexes will simplify this
even i will just use the colors? not the colors but the words red,blue,green,yellow,white,pink only
if those are the only words you'd need then it's more easy to store them in an array and using the rand() function to generate a number, check the word whose index matches the generated number and retrieve it
but can it be used without using words from a file? just only using turbo c itself.
either create an array containing them or randomly choose letters to fill a string
the only randomizing funtion for C I know is exclusive for integers only.
What you could do is create and store the words in an array or file then use the rand function to generate a number, the word whose index matches the number will be retrieved
randomizing in words
still vague, can you tell if you meant
generate letters randomly to form a word,
retrieve words randomly from a file or array,
or something else??
If at least one of those conditions is true it will pass on to the next set of statements
try using the && operator
you could format the output similar to C like so:
System.out.printf("Farenheit %.2f = %.2f Celsius",farenheit,celsius);
Sorry but we don't give away codes here the rule states Do provide evidence of having done some work yourself if posting questions from school or work assignments.
We can help you if you have specific questions on your code or if you need advice on what to do next
Anyway these are simple tasks where you only need to use the charAt method from the string class at the first index of your first application and a simple math equation for the second
You either die a hero or live long enough to see yourself become the villain.
i just want to learn about using random functions in words
do you need help in retrieving words from a file or generating random strings
turbo c only.
wouldn't you rather use a modern compiler than this antique
but isn't using notepad will be confusing? I mean no colors.
probably meant notepad++, a popular editor
also if you want to do it manually (terminal commands) use the javac command for compiling and java for running your programs
E A C K F H D B G
there can be a lot of ways for the elements to be created in an inorder traversal from a tree which makes a lot of possible preorder or postorder solution
is the root node/element given at least?
there's a trailing "|" at the 2nd condition of your while loop at line 19
My guess is you'd want to use backslash instead
I am tring to get an array of word lengths.
You need to add more details, do you mean the length of every word in a string will be stored in an array?
check the product key located at the cd where you bought your windows 7 or if it's preinstalled on a laptop check under it.
ooor did you actually buy your version of windows 7?
isn't the code you need similar to the program you posted in this thread. If so if you imply my suggestion of using a 2d array for the variable on the code there then you'll have char array (string) values from user input
yes you can do it like that for single character user input
change line 6 to char a[30][30] (a 2 dimensional array) instead of char a[30],b[30]; (2 arrays where array b is unused)
you probably wanted to use a 2d array like char a[30][30];
start with something like this:
char array[3][20]= { "one", "two", "three" };
printf("%s, %s, %s\n", array[0], array[1], array[2]);
for user input you can use a loop for every index
Can you give more details of the problems are you having, error messages, etc?
are you using the default software center program?