Search Results

Showing results 1 to 40 of 494
Search took 0.06 seconds.
Search: Posts Made By: Ancient Dragon ; Forum: C and child forums
Forum: C 6 Days Ago
Replies: 2
Views: 171
Posted By Ancient Dragon
Two things wrong with the if statement on lines 120 and 124
1) if statements must have ( and ). e.g. if( condition )


2) = is an assignment operator, == is a boolean logic operator. You want...
Forum: C 19 Days Ago
Replies: 2
Solved: dynamic array
Views: 328
Posted By Ancient Dragon
Function add() -- second parameter must also be passed by reference. You are just passing the pointer by value, which does nothing in main()'s copy of the pointer. Note the second parameter should...
Forum: C 20 Days Ago
Replies: 5
Solved: char in c?
Views: 380
Posted By Ancient Dragon
1) you failed to read Aia's comment.

2) The printf() statement is incorrect. %s is for a charcter array, shape is not a character array. What you want os %c
Forum: C 20 Days Ago
Replies: 5
Solved: char in c?
Views: 380
Posted By Ancient Dragon
>>if (length=breadth)

you are using the wrong operator -- use == boolean operator instead of = assignment operator.

>> shape= 'square';
Two problems with that line

All strings (two or...
Forum: C 23 Days Ago
Replies: 10
Views: 528
Posted By Ancient Dragon
Why did you use fgets() instead of fscanf()? fgets() gets the entire line without regard to spaces, which is not what you want. Look at the simple code I posted, it does what you need. All you...
Forum: C 23 Days Ago
Replies: 14
Views: 799
Posted By Ancient Dragon
Yes. Its not really all that big a deal since the program has reserved space for the data anyway. Even though you have the arrays declared in if statements the compiler will allocate memory for all...
Forum: C 23 Days Ago
Replies: 10
Views: 528
Posted By Ancient Dragon
>>The program is supposed to take in a file provided through standard input
That means get the name of the file from standard input, not the lines of the file. You have to open the file and read...
Forum: C 23 Days Ago
Replies: 14
Views: 799
Posted By Ancient Dragon
Yes it does work.



Read the file into the array just like it was any other normal text file.
Forum: C 23 Days Ago
Replies: 14
Views: 799
Posted By Ancient Dragon
>>Is there anyway to achieve this?
No because the #inc lude directive is processed at compile time, not runtime.
Forum: C 25 Days Ago
Replies: 8
Views: 451
Posted By Ancient Dragon
In that case go back to the code you originally posted here. inportb() only takes one parameter. It returns the byte read.
Forum: C 25 Days Ago
Replies: 8
Views: 451
Posted By Ancient Dragon
Does it use memory models, such as small, medium, compact and large? If yes, then it is a 16-bit compiler.
Forum: C 25 Days Ago
Replies: 8
Views: 451
Posted By Ancient Dragon
Yes, the 0x03f8 is the com port address for MS-DOS 6.X operating system. If you read through the links I posted you will find examples how to open the com port.

Are you using the 16-bit version...
Forum: C 26 Days Ago
Replies: 8
Views: 451
Posted By Ancient Dragon
you can not use inport and outpout with any 32-bit or 64-bit compiler. Those functions are no longer supported by the operating system. On MS-Windows you will have to use win32 api functions,...
Forum: C 26 Days Ago
Replies: 3
Views: 278
Posted By Ancient Dragon
why the pointers?

int function(user* users, int id, char name[], char surname[]){
strcpy(users[id].name,name);
strcpy(users[id].last,surname);
users[id].id=id2;
}


And in main() you need...
Forum: C 30 Days Ago
Replies: 6
Views: 400
Posted By Ancient Dragon
Here is how to get a list of the drive letters

#include <windows.h>
#include <iostream>


int main()
{
char buf[255];
char cDrive;
Forum: C 30 Days Ago
Replies: 6
Views: 400
Posted By Ancient Dragon
depends on the operating system.
Forum: C 34 Days Ago
Replies: 16
Views: 609
Posted By Ancient Dragon
>>well besides printing 1 to the display..

The reason for that should be obvious.

Also compiled with Code::Blocks using MinGW (gcc 3.4.5) and it worked ok.
Forum: C 34 Days Ago
Replies: 16
Views: 609
Posted By Ancient Dragon
Worked fine for me using vc++ 2008 express
Forum: C 34 Days Ago
Replies: 16
Views: 609
Posted By Ancient Dragon
>>while ((addr = ((void*(*)(void))addr)())

Didn't your compiler produce an error or warning on that line?? tryit() does not return a value, yet in the above addr is being assigned the return...
Forum: C Nov 5th, 2009
Replies: 2
Views: 286
Posted By Ancient Dragon
variable ptrA needs to have three stars

#define maxrows 2
#define maxcols 5


int main()
{
double a[maxrows][maxcols];
double ***ptrA = malloc(maxrows * sizeof(double*));
Forum: C Oct 29th, 2009
Replies: 15
Views: 532
Posted By Ancient Dragon
line 12: its int main().

The rest is just too difficult to read because of terrible formatting. Don't be afraid to use some spaces to indent lines.
Forum: C Oct 28th, 2009
Replies: 15
Views: 532
Posted By Ancient Dragon
something like this:

int array[10];
int i;
for(i = 0; i < 10; i++)
{
printf("%d\n", array[i]);
}
Forum: C Oct 27th, 2009
Replies: 15
Views: 532
Posted By Ancient Dragon
>>However the array dosent show
What does that mean? And please use code tags.
Forum: C Oct 25th, 2009
Replies: 3
Views: 264
Posted By Ancient Dragon
You need two loops to do that. You have to check each number against all the previous values.

int a[10] = {5,6,7,8,9,10.11,12,13,1};
int i,j,isTrue;
isTrue = 1; // assume true
for(i = 0; i < 9...
Forum: C Oct 23rd, 2009
Replies: 3
Views: 482
Posted By Ancient Dragon
We only help those who help themselves. Post the code you tried. You will have to know a little about pointers if you are required to pass variables by reference.
Forum: C Oct 22nd, 2009
Replies: 2
Views: 444
Posted By Ancient Dragon
never heard of such a thing, most likely because it would be grossly inefficient. The library at www.DataReel.com contains client/server code ported to both *nix and MS-Windows, but it uses standard...
Forum: C Oct 16th, 2009
Replies: 5
Views: 296
Posted By Ancient Dragon
use a loop that counts from 1 to the number you enter, then another loop that counts backwards back down to 1. Print the loop counter.
Forum: C Oct 8th, 2009
Replies: 6
Solved: calculator
Views: 395
Posted By Ancient Dragon
You would have to take the input "2 + 4" and rearrange it in reverse polish notation format. google for it and you will find examples.
Forum: C Oct 7th, 2009
Replies: 5
Views: 438
Posted By Ancient Dragon
Implement them as function pointers.
Forum: C Oct 7th, 2009
Replies: 6
Solved: calculator
Views: 395
Posted By Ancient Dragon
I think you have to rearrange this into polish notation. For example, if I enter "100 + 2" when the + operator is reached your program attempts to pop two values off the stack, then in fact there is...
Forum: C Oct 5th, 2009
Replies: 2
Views: 279
Posted By Ancient Dragon
Every program must have one main() function. The code you posted does not have that.
Forum: C Oct 5th, 2009
Replies: 4
Solved: bnary search
Views: 395
Posted By Ancient Dragon
Next time use code tags when posting code. That [code] link isn't just to make DaniWeb pretty.
Forum: C Oct 5th, 2009
Replies: 3
Views: 209
Posted By Ancient Dragon
The console is a shared resource among all threads. It would be just a jumbled mess if one thread tried to output text to the console screen at the same time you are trying to input text with...
Forum: C Oct 3rd, 2009
Replies: 6
Solved: binary search
Views: 551
Posted By Ancient Dragon
Your program is pretty close, you just need a few changes, such as int main(), use pointer to array in scanf() and flush out the '\n' characters

int main()
{
int array[50],i,ele,n;
char a;...
Forum: C Sep 30th, 2009
Replies: 5
Views: 734
Posted By Ancient Dragon
1) suggest you define macros STDIN and STDOU instead of hardcoding 0 and 1 in the read/write statements

#define STDOUT 1
#define STDIN 0


2) use sizeof operator to get the size of data

...
Forum: C Sep 25th, 2009
Replies: 20
Views: 742
Posted By Ancient Dragon
Can't use that in C programs.
Forum: C Sep 19th, 2009
Replies: 9
Views: 476
Posted By Ancient Dragon
>>scanf("%s",&Guess);
The "%s" tells scanf() that Guess is a pointer to a character array, not a single character. If all you want is a single character then call getchar() instead. (link...
Forum: C Sep 8th, 2009
Replies: 3
Views: 365
Posted By Ancient Dragon
pthread.h is not natively supported on MS-Windows operating system. But you can get win32 port of that. (http://sourceware.org/pthreads-win32/)
Forum: C Sep 7th, 2009
Replies: 3
Views: 365
Posted By Ancient Dragon
>>I would like to work on POSIX thread programming using TC v3.0

You can't -- that compiler is too ancient.

STL is supplied with a compiler because it is compiler-implementation specific. Your...
Forum: C Sep 7th, 2009
Replies: 9
Views: 415
Posted By Ancient Dragon
Maybe I misread the problem -- I thought "no." meant "not", which is why I posted the link I did.
Showing results 1 to 40 of 494

 


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

©2003 - 2009 DaniWeb® LLC