_avishek 29 For as long as space endures

Hello, Robin!

Might I suggest you read the following excellent article by Peter Norvig: "Teach Yourself Programming in Ten Years". Here's the link: http://norvig.com/21-days.html

I hope you find the article insightful.

ddanbe commented: Nice article! +15
_avishek 29 For as long as space endures

I have been out of Daniweb for the past three years. Returning now, I see many pleasant changes.

However, in one regard Daniweb has not changed -- it still seems to be flooded with homework problems!

_avishek 29 For as long as space endures

I do agree about the complexity part exceeding human comprehension. I currently work at a cancer hospital / research institute, and over the past few days have been struggling to link up one of our new CT scan machines with the vendor's server in Germany. It has stumped me, the CT scan machine vendor, and our network AMC vendors in one line!

_avishek 29 For as long as space endures

At work, I recently had an MBTI test done, and I came out as the INFP type. It seems to be a good indicator to my personality type, and offers some insight into the decision that I make. INFP personalities are associated more with ideals, music, and writing, but not programming. However, I have always approached programming the way I approach writing.

Just out of curiousity, I was wondering if there is a predominant type for those involved in IT, especially in programming.

So, if you will, please share your personality type!

_avishek 29 For as long as space endures

@Hyperion101:

Are you placing the semicolons correctly? Please take special notice of the for loop.

_avishek 29 For as long as space endures

Refer to the comments I have added to your original code.

#include <stdio.h>
#include <simpio.h>  /* Remove this */
#include <genlib.h>  /* Remove this */

main()  /* Should be int main(void) */
{
    float c, f;  /* Should be int f; float c; */

    for (f=0,f<200,f++20);  /* Should be for (f = 0; f < 200; f += 20) */
    {
        C = (5/9)*(F-32);  /* Should be c = (5.0 / 9.0) * ((float)f - 32.0); */
        printf("%f     %f",f,c); /* Should be printf("%d  %.1f", f, c); */
    }

    getchar();
}
_avishek 29 For as long as space endures

What on earth are you trying to achieve with this program? My eyes have started watering just looking at your code!

_avishek 29 For as long as space endures

how can i view the source code of my distro?

I have not used CentOS, but in the Linux distros I have used, the kernel source code is generally found in the directory pointed to by the /usr/src/linux symlink.

do we need that if we were to create a new system call?

I would say have to say "No". For system calls, you would need to concentrate on the /usr/include/sys directory, and especially the unistd.h header file to be found in that directory.

Have a look at this article: http://en.wikipedia.org/wiki/Unistd.h

_avishek 29 For as long as space endures

my flashdrive is in (F;)

Why are you running Turbo C from a flash drive? I think you would be better off installing it on your hard disk; that way at least you could ensure that the runtime directories are in their correct place. If you are using Windows 7, then this article may be of some help: http://hackstips.wordpress.com/2011/11/27/run-turbo-c-in-windows7/

try to go away from turbo C

How does this help in answering the OP's question? This suggestion would have been OK if you had first tried to answer the question. Keep in mind that quite often students have no choice in the matter of which compiler to use -- they have to use the compiler/IDE specified by their instructors.

use dev c++ or codeblockks or visual studio

Suggesting a student to use an IDE, no matter how modern, is in my opinion a very bad idea. IDEs have their use as production tools, but are counter-productive to the education of a student when used as pedantic tools. IDEs mask the build process, denying students an insight into the actual compilation and build tools. A further point in note, it's Code::Blocks, and not "codeblockks".

_avishek 29 For as long as space endures

in ubuntu probably at User/Include/gcc

On my Debian machine, the algorithm file can be found at one of the two locations:
* /usr/include/c++/4.4
* /usr/include/c++/4.4.5

It should be similar on Ubuntu. Remember that on Linux, file paths are case-sensitive!

_avishek 29 For as long as space endures

I think you need to declare the Game class in Entity.h like so:

class Game {};

Declaring the Game class with an empty member list should make it a complete declaration. Without the empty member list, the class would have an incomplete declaration, which would not allow any objects of it to be declared.

_avishek 29 For as long as space endures

Xubuntu is a good choice. You can download the LiveCD, and use it to boot your laptop. If everything works out OK, you can choose to install the OS. You can download it from here: http://xubuntu.org/

_avishek 29 For as long as space endures

@WaltP: Thank you for the clarification. Guess I was missing the bigger picture!

_avishek 29 For as long as space endures

The link you posted discusses the ToJSON function -- this function is a T-SQL function, and NOT a C/C++ function.

You will be able to call the ToJSON function only from within SQL Server stored procedures and functions, and not from C/C++ code.

For your purpose, I think JsonGlib would be more suitable. Have a look at this link: https://live.gnome.org/JsonGlib

_avishek 29 For as long as space endures

so yes, recursion is a loop

Correct me if I'm wrong, but my understanding was that a new stack frame would be pushed on to the call stack for each recursive call to a function; this does not happen with a loop construct.

_avishek 29 For as long as space endures

In order to use pthread_create() you will need to include <pthread.h>. Note that <pthread.h> is available only for POSIX systems.

_avishek 29 For as long as space endures

I think I understand your question a bit better, now that I have re-read it.

Calling main() from within main() would be an example of recursion, and not looping. Even so, I don't think recursion on main() is a very good idea. From what I know, it is outright illegal in C++.

_avishek 29 For as long as space endures

I am not sure that I understand your question completely.

A loop is a programming construct that repeatedly executes some code while a certain condition is true. Examples are the "for" and "while" constructs.

If you are asking whether something like this is possible:

for(;;) {
    main();
    program();
}

then I would have to say "No". The main() function is the entry point for an application; each program would have its own main() function. On the other hand, something like this should be possible:

#include <stdlib.h>

int main(void)
{
    for(;;) {
        system("program1");
        system("program2");
    }
}

where "program1" and "program2" are different programs.

_avishek 29 For as long as space endures

Have a look at this article; it may be of help:

http://ubuntuforums.org/showthread.php?t=947124

_avishek 29 For as long as space endures

@LastMitch: I'm especially fond of Sarah Brightman's duet with Andrea Bocelli in "Time to Say Goodbye".

_avishek 29 For as long as space endures

moderator eyes have stopped completely working

@ra527: Even after having been banned twice, why do you insist on posting such rude comments? You still have a lot to learn, not just about programming (your code is sloppy at best) but also on how to behave.

_avishek 29 For as long as space endures

Sarah Brightman

_avishek 29 For as long as space endures

I think you need to prepend the keyword "extern" in line 10 of globals.h like so:

extern SDL_Surface* screen = NULL;

I also think that you need to prepend "extern" before the declaration of all the other global variables in globals.h.

_avishek 29 For as long as space endures

You need to use your imagination.

I agree with Squidge, you really should use your imagination -- it's a lot more fun then!

Whenever I'm trying out a new bit of technology, I always make an application called "Ye Olde Pirate Shoppe", be it a desktop app or a web app. As a web app, "Ye Olde Pirate Shoppe" is an online shopping store for pirates, offering such unique items as skulls, parrots, rum, and cutlasses.

these cars computers bikes n all are boys stuff

I presume you are looking for some "feminine"-themed ideas?

_avishek 29 For as long as space endures

From your screenshot, I see that you are running DOSBOx. DOSBox is an emulator for the old MS-DOS. The wiki page http://www.dosbox.com/wiki/Main_Page clearly states that:

DOSBox also comes with its own DOS-like command prompt. It is still quite rudimentary and lacks many of the features found in MS-DOS, but it is sufficient for installing and running most DOS games.

It is more than likely that DOSBox does not support the "ipconfig" command, which would explain why you are receiving the illegal command error.

Out of curiousity, why are you using DOSBox as a programming environment? It was never designed for such a purpose.

Ancient Dragon commented: agree +14
_avishek 29 For as long as space endures

system("ipconfig/all");

Just a thought, but shouldn't there be a space between the "ipconfig" and the "/all" switch? Possibly that is the cause of the illegal command error.

I would request someone using Windows to cross-check.

_avishek 29 For as long as space endures

Now, let me tell you a little secret about 'Being happy'

"You are what you think. All that you are arises from your thoughts. With your thoughts you make your world." -- The Dhammapada

_avishek 29 For as long as space endures

I'm using Linux, so I can't try out DOS commands, but from what I recall both "date" and "ipconfig /all" are valid commands.

Maybe I'm nit-picking here, but the OP's heading makes the question a bit ambiguous as to which command is giving the error.

_avishek 29 For as long as space endures

You also need to

#include <math.h>
_avishek 29 For as long as space endures

That's pretty neat! I did not know about these implied name spaces.

+5% cooler to you!

_avishek 29 For as long as space endures

You can use a single call to scanf() as follows:

int x, y, z;

printf("Enter 3 integers separated by a space:");
scanf("%d %d %d", &x, &y, &z);
_avishek 29 For as long as space endures

You will get 100 if you change your printf() call as follows:

printf("\n%.0f", *pf);

The reason you are not getting 100 with your printf() call is essentially because computers represent floating point numbers and integers differently. The IEEE single-precision floating point format represents a floating point number as a 24-bit mantissa and an 8-bit exponent. So, (float)100.00 is represented differently from (int)100.

In your example, "i" is being used as a buffer to hold the bits for (float)100.0. Your printf() call is displaying that buffer as an integer, my printf() call is displaying that buffer as a float.

_avishek 29 For as long as space endures

Just out of curiousity, what relevance does this have to C?

_avishek 29 For as long as space endures

@rithish: Have you checked the URL that you have posted? It hardly seems to have any relevance to the poster's question.

@chandnigandhi: Since you are talking about a mini project, I would suggest you start out by thinking about some problem relevant to your daily life, and then developing a solution to that problem -- it makes it a lot more enjoyable!

For example, perhaps you are a generous person and lend a lot of money to your friends, and you need a little application to keep track of how much you have lent to each of your friends.

_avishek 29 For as long as space endures

My understanding of the C language is that the same identifier cannot be reused. However, the code below compiles on GCC without complaints, even when using the "-Wall -pedantic" flags. Is there something that I am missing? Does the standard say anything about functions/macros having the same name as typedef'd types?

#include <stdio.h>

typedef int error;

#define init() error var_error = -6

#define error() ((const error)var_error)

int main(void)
{
    init();
    printf("error() = %d\n", error());

    return 0;
}
_avishek 29 For as long as space endures

Although it wasn't asked for, I would imagine that a backslash \ would be required to terminate all but the last line.

I would also imagine that two terminating curly braces }} would be required on the last line.

_avishek 29 For as long as space endures

I seem to have figured out the problem. The ifeq block should be as follows:

ifeq (${ppd_dbg},evd_comvar_debug)
   pth_lib = ./lib/dbg
else
   pth_lib = ./lib/rls
endif

The problem was occurring because because of the additional space between the parentheses and the enclosed condition.

It seems that in a makefile, a space should be kept after the ifeq and the left parenthesis, but no space subsequently. Interestingly enough, make does not report an error in case the extra space is encountered.

@kings_mitra: thank you for your reply. The condition ifeq (${ppd_dbg},evd_comvar_debug}) was required as I wanted to ensure that ppd_dbg is set to evd_comvar_debug, and not just its value (which could have been specified through another variable).

_avishek 29 For as long as space endures

Hello, world!

This is my first post on DaniWeb, though I have frequented it quite often.

I'm using gcc and make (on Ubuntu 10.10) with GVim for creating a foundation library in C. Within my code I've built in rudimentary profiling and assertion policies that are enabled through a symbolic constant evd_comvar_debug. The appropriate entries in my makefile are as follows:

# compile-time symbolic constants; 'evd' is a namespace
# evd_comvar_ndebug is supposed to switch off debugging
# evd_comvar_debug is supposed to switch on debugging
#
evd_comvar_ndebug = 0
evd_comvar_debug =1

# makefile variable to toggle the debugging option
# in this case, we have chosen to switch on debugging
#
ppd_dbg = evd_comvar_debug

# conditional selection of output directory for the compiled archive
# if debugging is enabled, the compiled archive should be saved in ./lib/dbg
# if debugging is disabled, the compiled archive should be saved in ./lib/rls
#
ifeq ( ${ppd_dbg}, evd_comvar_debug )
   pth_lib = ./lib/dbg
else[ICODE][/ICODE]
   pth_lib = ./lib/rls
endif

# object archive generation
# flg_ar are flags to be passed to 'ar'
# bin_obj specifies the list of objects that have been compiled
#
flg_ar = rvu ${pth_lib}/$@ ${bin_obj}

Now, I have seen that debugging is switched on/off as expected during the compilation process by setting ppd_dbg to evd_comvar_debug or evd_comvar_ndebug. This is OK, as it is the expected behaviour.

My problem is, that no matter what the value of ppd_dbg, the generated archive file is being saved in ./lib/rls. It should be …