Forum: C Mar 12th, 2007 |
| Replies: 49 Views: 10,424 I hope I don't "burn my bridges" by adding this but here it is. I'd like to say one thing, in reference to Walt's solution code to another. Consider the following which would do the exact same thing... |
Forum: C Mar 10th, 2007 |
| Replies: 49 Views: 10,424 Problem solved by Walt's code.
LamaBot |
Forum: C Mar 10th, 2007 |
| Replies: 49 Views: 10,424 Ok, keep the code I just said to changed, changed and try this.
void populate(int array[][col], int row_size, int col_size) {
int x, y;
for (int... |
Forum: C Mar 9th, 2007 |
| Replies: 49 Views: 10,424 When you cout the locations, try the following to see if it works then:
for (int i=0;i<=row_size;i++) {
for (int j=0;j<=col_size;i++) {....
This might be the reason you can only see around... |
Forum: C Mar 9th, 2007 |
| Replies: 49 Views: 10,424 One last thing, I don't think you wan the following:
if(array[x][y]!=0)....
Reason; because you want to populate positions in the array aren't already occupied therefore you'd want to change... |
Forum: C Mar 8th, 2007 |
| Replies: 21 Views: 5,687 You might want to take the amount entered by the user, check to see if the amount is greater than what the coins are worth and skip that coin if it is. Once you reach the coin that doesn't exceed the... |
Forum: C Mar 7th, 2007 |
| Replies: 49 Views: 10,424 Walt, when I'm using for loops, my C++ compiler allows me to declare and initialize a variable within a for loop. I don't know if that is valid standard C syntax though. Here is a link briefly... |
Forum: C Mar 7th, 2007 |
| Replies: 49 Views: 10,424 Yeah that is probably the problem. An easier way to confirm this is just declare i and j as integers before executing the for loop. Sometimes when I'm writing a reply post, another post gets posted... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 Here is the modified code:
#define rows 7
#define columns 10
#define max_total 12
#define id 1
void array1( int (*multi_d)[columns])
{ |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 As mentioned above, I thought you wanted a random number with a maximum of 12 objects in the array. My original method uses the fact that it is possible to overwite the values whose coordinates are... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 In his sample code it had a constant using MAX in its identifier. I took it as it had a maximun but not a minimum, which is why I specifically wrote it this way as to indirectly have the number of... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 You don't use it with rand, you use it with srand - which is used to seed rand. If you use just use rand without seeding rand, every function call it'll produce the same values for x and y, that is... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 multi-d[rows][columns] = {{0},{0}};/*Initialize all elements to zero*/
This will initialize the first and second row's first element's to the value of 0.
Since it IS necessary you use a... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 You're right. I'll keep that in mind. Darn my lack of common sense. |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,424 Is an absolute requirement that you use a multidimensional array of integers? It'd make the program a little easier if you just used a single dimension array, especially when you transverse the... |
Forum: C Mar 4th, 2007 |
| Replies: 49 Views: 10,424 Cool! Ok I understand. Thanks for clear that up:
#define elements 100
#define ID 10
void array1(int *multi_d) {
int position;
/* Put initialization code here (i.e. array = all zeros)... |
Forum: C Mar 4th, 2007 |
| Replies: 49 Views: 10,424 If the multi-dim array is of fixed length, then most of the work is done for you. Simply declare a mutli-dimensional array then assign the locations the distinguishing numbers. Although if you're... |
Forum: C Mar 1st, 2007 |
| Replies: 9 Views: 1,342 Here you go: http://www.cplusplus.com/strstr
To find the postion using strstr, the sample provided on this page shows you a wat to do it:... |
Forum: C Feb 28th, 2007 |
| Replies: 27 Views: 3,954 Well both methods would have the same effect but the programming would be different. Might take a bit more overhead because it'd have to check number of words back then jump back to that position... |
Forum: C Feb 28th, 2007 |
| Replies: 27 Views: 3,954 I'm assuming you just want to decompress the already compressed file. I don't know how the compressed file is formatted but here is an idea that might help:
Make a list of elements that are... |
Forum: C Feb 26th, 2007 |
| Replies: 22 Views: 4,235 Make sure you've got the following statement within and at the end of the "reverseString" function:
output[counter] = '\0';
Good luck, LamaBot |
Forum: C Feb 26th, 2007 |
| Replies: 22 Views: 4,235 This is just to follow up on my previous example:
#include <stdlib.h>
#include <stdio.h>
#define STR_SIZE 10
void reverseString(const char *input, char *output, int buffer_len);... |
Forum: C Feb 25th, 2007 |
| Replies: 22 Views: 4,235 One obvious way is to use a for loop or while loop; example:
void reverseString(const char *input, char *output, int buffer_len) {
int counter = 0;
for (;buffer_len >= 0;... |
Forum: C Feb 15th, 2007 |
| Replies: 4 Views: 3,207 Hello amt,
I'm not sure if you're using *nix or MS Windows or etc, but I'll just assume you're using Windows. The Microsoft website, http://microsoft.com, has mucho information and documentation,... |