Search Results

Showing results 1 to 40 of 42
Search took 0.01 seconds.
Search: Posts Made By: Lazaro Claiborn
Forum: C Mar 12th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
Problem solved by Walt's code.

LamaBot
Forum: C Mar 10th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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,653
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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 7th, 2007
Replies: 9
Views: 3,324
Posted By Lazaro Claiborn
Sorry my mouse is sticky.
Forum: C++ Mar 7th, 2007
Replies: 9
Views: 3,324
Posted By Lazaro Claiborn
Also I've noticed the "file" is colored. Is that a key word? That I'm not sure of. If it is, try to change the name to files to see if it'll work that way.

Good luck, LamaBot
Forum: C++ Mar 7th, 2007
Replies: 9
Views: 3,324
Posted By Lazaro Claiborn
Hello, when you use the code tags, code is not sufficient. For c source code you'd specify the code tag as and for cplusplus code=cplusplus and both have the same closing tag code. Try to use them....
Forum: C Mar 5th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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: Networking Hardware Configuration Mar 5th, 2007
Replies: 2
Views: 1,614
Posted By Lazaro Claiborn
Why use a program? Can't you use Excel or some other application to account for each download? For instance, you find something you want to download, you enter the download size in the corresponding...
Forum: C Mar 5th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
You're right. I'll keep that in mind. Darn my lack of common sense.
Forum: C Mar 5th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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 5th, 2007
Replies: 6
Views: 4,162
Posted By Lazaro Claiborn
Ok at this point in the program, p points to the first element in the list. Keep that in mind.


So no matter what, p is assigned q. Keep that in mind.



So the else is executed if the...
Forum: C++ Mar 5th, 2007
Replies: 6
Views: 4,162
Posted By Lazaro Claiborn
int main should to return an int.

Good luck, LamaBot
Forum: C Mar 4th, 2007
Replies: 49
Views: 10,388
Posted By Lazaro Claiborn
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,388
Posted By Lazaro Claiborn
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: 19
Views: 52,220
Posted By Lazaro Claiborn
I totally agree with you but a newbie would be learning the concepts rather than the specifics. In many beginning programming books and classes they'd probably teach the concepts of programming...
Forum: C Mar 1st, 2007
Replies: 9
Views: 1,334
Posted By Lazaro Claiborn
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
Solved: Uncompress
Views: 3,939
Posted By Lazaro Claiborn
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: 19
Views: 52,220
Posted By Lazaro Claiborn
I have written pages for my site regarding that issue. To you it is not intuitive. Unless the newbie has a very large string, using strlen isn't a truely bad thing to do; because it will not have to...
Forum: C++ Feb 28th, 2007
Replies: 19
Views: 52,220
Posted By Lazaro Claiborn
str.lenght() <-- Enclosing Parenthesis

:lol: :lol: :cheesy:

[[ <--- Brackets
[ <--- Opening Brackets
] <--- Closing Brackets
[] <--- Enclosing Brackets
Forum: C++ Feb 28th, 2007
Replies: 19
Views: 52,220
Posted By Lazaro Claiborn
Well that'd be the problem if the string contained a massive amount of characters - which you nor I know. I read the link you'd posted and I still don't realise the problem. Lol. :lol: I realised...
Forum: C++ Feb 28th, 2007
Replies: 19
Views: 52,220
Posted By Lazaro Claiborn
Umm... obfuscated???? It is rather easy to understand, which is why I wrote it like that. Actually, strlen(str.c_str()) could be replaced with, say "str.length" perhaps. However, it is not...
Forum: C Feb 28th, 2007
Replies: 27
Solved: Uncompress
Views: 3,939
Posted By Lazaro Claiborn
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 28th, 2007
Replies: 19
Views: 52,220
Posted By Lazaro Claiborn
Here is a function that'll do it:

string UpToLow(string str) {
for (int i=0;i<strlen(str.c_str());i++)
if (str[i] >= 0x41 && str[i] <= 0x5A)
str[i] = str[i] + 0x20;
...
Forum: C++ Feb 27th, 2007
Replies: 3
Views: 1,079
Posted By Lazaro Claiborn
The function doesn't return anything, so you need to use "void". Second, Quote will terminate once the function exits which you can extract later so you'll need to pass by reference or via pointers....
Forum: C Feb 26th, 2007
Replies: 22
Views: 4,228
Posted By Lazaro Claiborn
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,228
Posted By Lazaro Claiborn
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,228
Posted By Lazaro Claiborn
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 21st, 2007
Replies: 26
Views: 5,490
Posted By Lazaro Claiborn
You're right swap and replace are not suitable for this OPs code, that wasn't my point though. If I really would of suggested something it'd probably would of been the following:


eos =...
Forum: C++ Feb 20th, 2007
Replies: 26
Views: 5,490
Posted By Lazaro Claiborn
Ok that makes a load of sense. :confused:



I guess I don't like to use "new" unless declaring a new class instance. I rarely use it for a structure but I thought I'd remind if not inform the...
Forum: C++ Feb 20th, 2007
Replies: 26
Views: 5,490
Posted By Lazaro Claiborn
If this were a C++ program why use strcpy instead of str::swap, swap or std::replace? And if you didn't notice, I mentioned it is an alternative method; I personally don't like to see a lot of...
Forum: C++ Feb 20th, 2007
Replies: 26
Views: 5,490
Posted By Lazaro Claiborn
Being the nerd I am, I'll give my opinion on this particular issue. If you're going to use a structure data type, I'd just use malloc instead of new to allocate memory on the heap:

PCourant =...
Showing results 1 to 40 of 42

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC