Search Results

Showing results 1 to 40 of 79
Search took 0.03 seconds.
Search: Posts Made By: VernonDozier ; Forum: C and child forums
Forum: C Oct 14th, 2009
Replies: 3
Views: 296
Posted By VernonDozier
Yeah, that sounds like a bit more than I want to tackle. I'll just give them different names. Thanks to both of you.
Forum: C Oct 14th, 2009
Replies: 3
Views: 296
Posted By VernonDozier
I've googled this and it looks to me like what I am trying to do is impossible. I'm trying to write a Displayfunction that can take different parameters and call the appropriate function based on...
Forum: C Sep 20th, 2009
Replies: 5
Views: 1,473
Posted By VernonDozier
OK, thanks. Will give it another shot.
Forum: C Sep 20th, 2009
Replies: 5
Views: 1,473
Posted By VernonDozier
What if the file is one huge line with a million names, no line breaks, and I only want the first, say, 10 names? Do I still have to either read a whole line or write my own getline that can accept...
Forum: C Sep 20th, 2009
Replies: 5
Views: 1,473
Posted By VernonDozier
I have a data file that, if I was using C++, I would use the getline function to read its data into the proper variables. However, the getline functions that C++ allows appear to not be available to...
Forum: C Nov 23rd, 2008
Replies: 25
Views: 1,815
Posted By VernonDozier
All this program does is open mspaint with the Mickey Mouse picture.


int main()
{
system("mspaint c:\\mm.jpg");
return 0;
}
Forum: C Nov 22nd, 2008
Replies: 25
Views: 1,815
Posted By VernonDozier
niek_e, Did you create the lonely_girl profile just so you could post your Mickey Mouse program and this response?

Regardless, +rep to both of you, if there are two of you, for making me laugh.
Forum: C Sep 12th, 2008
Replies: 2
Views: 669
Posted By VernonDozier
int main()
{
int i;
char a[32],*a1,b[64],*b1;
a1=&a[0];
b1=&b[0];

for (i = 0; i < 26; i++)
a[i] = i + 65;
a[26] = 0;
Forum: C Sep 7th, 2008
Replies: 7
Views: 679
Posted By VernonDozier
You still have to fix your initialization of the done[15] element, but the seg fault is gone since you've now set aside 16 elements. As far as the logic goes, it makes sense and it seems like it...
Forum: C Sep 6th, 2008
Replies: 3
Views: 443
Posted By VernonDozier
You can't use string in C. Also, we can't run the program since you haven't provided the GetLine and GetInteger and StringCompare functions.
Forum: C Sep 6th, 2008
Replies: 7
Views: 679
Posted By VernonDozier
Your done array has 15 elements and thus can handle indexes from 0 to 14. val has a potential range of 0 - 15. You have this on line 15:


if(!done[val])


which will be this if val is 15:
...
Forum: C Aug 15th, 2008
Replies: 4
Views: 1,721
Posted By VernonDozier
Well if you have the following equation:

f(x)=3x^2-5x

you need to extract the 3 and the -5. You need to know exactly what assumptions you can make regarding the user input (i.e. can you assume...
Forum: C Aug 4th, 2008
Replies: 5
Solved: Twin primes
Views: 1,086
Posted By VernonDozier
"It still doesn't work" isn't descriptive enough. It does work, to a point, but you are getting repeats. If x and y both flunk the primality test, n1 and n2 are unchanged and are printed again. ...
Forum: C Aug 4th, 2008
Replies: 5
Solved: Twin primes
Views: 1,086
Posted By VernonDozier
Lines 13 and 19. Make sure you have the larger number to the left of the % sign and the smaller number to the right of the % sign.

Lines 15 and 21 don't seem to do anything. x already equals x...
Forum: C Aug 4th, 2008
Replies: 5
Solved: Twin primes
Views: 1,086
Posted By VernonDozier
I'm not sure why you have a nested loop in this program. I don't think you need one. I think I would create a function that returns true or false (1 or 0) based on whether a number is prime. ...
Forum: C Jul 29th, 2008
Replies: 9
Views: 987
Posted By VernonDozier
Yes, but well deserved. The OP gave absolutely no indication at all (in either post) of what he was looking for. We are simply left to guess.
Forum: C Jul 28th, 2008
Replies: 9
Views: 1,042
Posted By VernonDozier
What kind of chip? Are you talking about microcontrollers? I use PIC microcontrollers, but there are a whole bunch of chip types and manufacturers and a whole bunch of C compilers. I would go to...
Forum: C Jul 25th, 2008
Replies: 8
Views: 1,041
Posted By VernonDozier
I question whether you want to #define this function instead of just declaring it at the top. Try replacing



#define GCD();


with this:
Forum: C Jul 25th, 2008
Replies: 15
Views: 1,404
Posted By VernonDozier
First, make sure you are using a C compiler if this is a C program and make sure the extension at the end of the file is .c, not .cpp. If this is a C++ program, you're in the wrong forum. Assuming...
Forum: C Jul 25th, 2008
Replies: 15
Views: 1,404
Posted By VernonDozier
Ah, OK, you are referring to these lines, perhaps?


x = ((-b - d)/(2.0*a));
y = ((-b + d)/(2.0*a));


I get a warning in C++ (not an error) which says "Warning: Converting from 'int' to...
Forum: C Jul 25th, 2008
Replies: 15
Views: 1,404
Posted By VernonDozier
You have that backwards. These lines:


#include <iostream>
using namespace std;


are fine with a C++ compiler, but cannot be used with a C compiler.
Forum: C Jul 25th, 2008
Replies: 15
Views: 1,404
Posted By VernonDozier
iostream isn't in C. I think you have quotes where you want <> in your #include for math.h, and you can't use "using namespace std" in C. Maybe you're not using a C compiler.

The problem with...
Forum: C Jul 24th, 2008
Replies: 6
Views: 1,428
Posted By VernonDozier
Definitely don't write 100 if statements. If you have a 2-D array of doubles, like, say:


double groups[100][MAX_NUM_ELEMENTS_IN_GROUP];


where 100 is the number of groups, as in your case,...
Forum: C Jul 3rd, 2008
Replies: 19
Views: 3,574
Posted By VernonDozier
Well, do you care whether it's accurate for the past two millenia? struct_tm goes back to 1900. I'm thinking jephthah might have been writing this tongue-in-cheek. I wouldn't worry about it unless...
Forum: C Jul 2nd, 2008
Replies: 19
Views: 3,574
Posted By VernonDozier
Well I don't see where the Zodiac sign comes in (Do you want to display "Cancer", "Leo", etc.?). Also, you have bday, standing for birthday, being represented by single integer. It sounds like you...
Forum: C Jul 2nd, 2008
Replies: 19
Views: 3,574
Posted By VernonDozier
You have some syntax errors.


#include <stdio.h>
int main(void)
{
char: actors_name[40];
scanf("%s", actors_name);
char: film_name[40];
scanf("%s", film_name);
Forum: C May 30th, 2008
Replies: 13
Views: 25,689
Posted By VernonDozier
One, you've already asked this here:
http://www.daniweb.com/forums/thread126749.html
Two, this thread is over a year old. Stick with the thread you already have. If you show some effort, you'll...
Forum: C May 29th, 2008
Replies: 5
Views: 645
Posted By VernonDozier
I'm guessing you have a problem in line 4 when you declare your 2-dimensional array:

num[2][n];

At this point n is uninitialized. You don't get a value for n till line 7 so it's impossible to...
Forum: C May 21st, 2008
Replies: 8
Views: 2,070
Posted By VernonDozier
#include <stdlib.h>
#include <stdio.h>
int main()
{
/*Some food items and all non-food items are subject to a statewide sales tax and local*/
/*district taxes. Due to differences in district...
Forum: C May 19th, 2008
Replies: 8
Views: 2,070
Posted By VernonDozier
Have you used functions yet? I'd start out by deciding what the input and output will be (i.e. do you read from an input file? Does the user enter data? How should the data be outputted to the...
Forum: C Mar 30th, 2008
Replies: 9
Views: 746
Posted By VernonDozier
Well there's your problem. If sort.c doesn't exist yet, then you can't call these two functions yet:


void shells_sort(int n, int *A, int sort_ascending, work_counter *work);

and

void...
Forum: C Mar 30th, 2008
Replies: 9
Views: 746
Posted By VernonDozier
Do you have the implementation code for the functions in sort.h? It needs that file too in order to compile.
Forum: C Mar 30th, 2008
Replies: 9
Views: 746
Posted By VernonDozier
Does it compile on another compiler? Could be some specific option in Visual C++ that needs to be changed in the linker or whatever. Hard to say. Or it could be in the code itself. Posting the...
Forum: C Mar 17th, 2008
Replies: 14
Views: 1,538
Posted By VernonDozier
I ran your code. It asked me to guess once each time through the loop. It did give me a line like this:

to low enter higher numberwolud you like to play again (y or n)?

Is that the problem...
Forum: C Mar 15th, 2008
Replies: 14
Views: 1,538
Posted By VernonDozier
Post your modified code and I'll run it and see if it does the same for me.
Forum: C Mar 15th, 2008
Replies: 14
Views: 1,538
Posted By VernonDozier
Well, that's because it is starting a new game. So do you want the person to have more than one guess for an individual game? If so, you would need some type of nested loop within your DO-WHILE...
Forum: C Mar 15th, 2008
Replies: 14
Views: 1,538
Posted By VernonDozier
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main(void)
{
char runagain='y';
srand(time(NULL));
int randnum=rand()%100 +1;
int guess=0;
Forum: C Mar 15th, 2008
Replies: 14
Views: 1,538
Posted By VernonDozier
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main(void)
{
int runagain=0;
srand(time(NULL));
int randnum=rand()%100 +1;
int guess=0;
Forum: C Mar 14th, 2008
Replies: 4
Views: 512
Posted By VernonDozier
I think you have your loops inverted here. The outer loop control variable should be incremented by 1 each pass through the outer loop. The amount the inner loop increments should vary. You have...
Forum: C Mar 13th, 2008
Replies: 4
Views: 521
Posted By VernonDozier
I don't think switch would be a good fit here. In order to use "switch" on a variable, the variable's type must be an ordinal type. You are comparing strings, and string is not an ordinal type, so...
Showing results 1 to 40 of 79

 


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

©2003 - 2009 DaniWeb® LLC