~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

vista will use WinFX (which is like .net)

(Disclaimer: Just my 2 cents)

Yeah thats the main problem with these MS guys, they just do whatever makes them $$$$.

Opensource is the future. I dont think anything can beat the C++ / Python combo.
(Python: Scripting, front end, rapid prototying)
(C++: If you feel like optimizing or writing the core modules)

But then again it depends on how you see things, many people regard MS as god and will follow whatever put in front of them, so they just go with the Drag-and-drop-and-live-happily-ever-after thing.

Many people like to take things in their own hands and like to develop and contribute to the community than working on some proprietory format and waiting for the MS guys to further optimize the amount of effort required in dragging and dropping the components. ( its much more challenging making VB than making softwares in VB, i hope you catch the drift )

But still take your own pick and enjoy programming.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Looks like you have got your specification of stack wrong out there.
Please take a look HERE.

  • Also what exactly does D_size stand for ? You cant just change the size of an array once declared.
  • Also dont use "system("pause")" for pausing the program, its bad programmign practice. Use "cin.get()" instead.
  • Your push and pop operations dont take any parameters,so how would they know which stack to perform those operations on ?
  • Also write the helper functions like "is_empty( Stack a )" and "is_full( Stack b )" to perform easy runtime checking.

Incorporate those changes and then repost but do read the link i have posted.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yeah i agree with you OP, lets get "back to primitive"...

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Welcome to Daniweb buddy.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Heh definately the beginning of a brave new world for me :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

wikipedia => wide network

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Something like

int main( void )
{
    char choice[2] = {'\0'} ;
    do
    {
        fgets( choice, 2, stdin ) ;
        choice[0] = tolower(choice[0]) ;
    }
    while ( choice[0] != 'y' && choice[0] != 'n' ) ;

    return 0 ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You are using the structures before even declaring or defining them. Make the definition of the two structures hStat and dStat precede the definition of Database and it should go allright.

Also if you have not done "#define SIZE 100" or any other constant value it will flag an error.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Post what you have put up tilll now and we will definately help you out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Try out something like this, though its a bit round about way, but should work:

double return_round( double value, double total )
{
    char buffer[BUFSIZ] = {'\0'} ;
    double percentage = ( value / total ) * 100 ;
    printf( "\nActual number: %lf", percentage ) ;

    sprintf(buffer, "%0.2f", percentage) ;

    if ( buffer[ strlen( buffer ) - 1 ] >= '5' )
        buffer[ strlen( buffer ) - 2 ] += 1 ;
    buffer[ strlen( buffer ) - 1 ] = '\0' ;

    printf( "\nThe rounded string is: %s", buffer ) ;

    return atof( buffer ) ;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The question is about rounding off the returned value and not rounding off while displaying. Read the first post.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why not just write a small check function which will do the small grained tasks for you which unnecessarily clutter the "main()".

int is_valid( int value )
{
    if ( value < 0 || value > 100 )
        return 0 ;
    else
        return 1 ;
}

And carrying ahead with Mr. Infarcion's advice, do something like

// ask the user to enter the data in a loop
// accept the data in the required variable
if( is_valid( required_variable ) )
    continue;
else
{
    printf ("Data out of range") ;
    exit (1) ;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yeah even i like that game, played using all characters, but never had the chance to experience online gameplay.

and btw Cheating is bad bad bad ..... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I think you have not explained the problem statement properly. For eg. if the user enters that he wants change for 2 dollars then the possibilities are:

4 halfs OR 8 quarters OR 20 dimes and so on....

Also why you need to pass the constant global arrays to the functions.

Why need a for loop in main (). Let the function take care of all the iterations and keep main() as simple as possible.

Also instead of declaring seperate variables declare an array of the size of NUM_COINS and keep filling it with the coins of each type and actually pass THAT array as reference to the function.

Hope it helped, bye.

PS: Dont use "system ("pause")" since using system functions is not that good a programming practice. Insted use "getchar()"

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

true as hell, but he didn't say he wanted to keep it

Joking aside, it is actually is a OO practice to pass a constant variable to a display function and normally display functions dont manipulate the data passes to it.
Its bad bad bad..... :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
#include <stdio.h>
#include <unistd.h>
#if !(WIN32)
 #define beep(x,y)
#endif

What does the above stmt stand for, what are you defining "beep" to be.
It actually defines "beep (x, y)" such that every occurance of the function is replaced by a space (' ').

Looks like you got the code snippet wrong, or you are missing something.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

right click

What ???

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What you ask is a bit fuzzy, can you post a well detailed example?

All your game specific questions would be better answered HERE.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What do you mean "This of course would require some minor redesign every time your counter is accessed in the code"?

I think what Mr. WaltP means is that when you have to get the actual value of the counter you have to take into consideration the current "counter" value as well as the "number_of_times_counter_overflowed".

For eg.
If current counter value = 12324 and it has already overflowed 2 times then the actual counter value can be obtained by:

actual_counter = counter + overflow_times * MAX_COUNTER_VALUE ;

But its just what i think, for the actual theory you will have to wait till he again comes online :D

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Would it be ok for you if you used an external time library. If yes then you can try out C++ Boost Date time library:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Using a while loop would be a better option.
If you want more help then please post your entire code so that we can help you out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about starting HERE and http://www.sgi.com/tech/stl/

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmmm almost there.
You just need to change

if the score is > 0 and < 100 then

Why cant the score be 100 ?

Just loop through the scores, and at the same time check for the above condition, if not satisfied duck out of the program using "exit (1)" or just consdier the score as 0 and move on.

And to start off programming there are many basic tuts on the C language in the forum sticky at the top of C++ forum here.

Or if you know a bit of C just post what you can do and we will try to help you out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello Sir. :)

Welcome to DaniWeb

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Pleasing changes, i agree but not necessary.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

nervous because his..

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Congratulations Wolfie and looks like you are one step ahead of me coz i didnt get the evaluation page you got. (looks like i am dooing something wrong :( )

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How does the king know that one of the slaves is stealing the gold used for making the trinkets ???
This means he must have weighed it and so he knows who the thief is ???

Please explain Mr. AD

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

C: Just relax and have that cup of tea. You're probably hallucinating anyway.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I second the opinion, but it definately is cool
:D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

'nuff said.

I knew this discussion would turn out this way :mrgreen:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

works fine too, saves CPU-time

... by destroying the original string :mrgreen:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I dont know what kind of ads are you people talking about, for eg. Mr. Ancient Dragon and Mr. Infraction. I just got to see my results within 2 - 3 clicks of my mouse after completing the test.

PS::

Looks like for the time being only Mr. Ancient Dragon and Me possess the "Abstract Reasoning Aura" :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

C: Back away and make that cup of tea to help you calm down and think this through.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I got spatial too. But I am sure I got all but one correct. How do you get the results?

Hmm... well when you had appeared you had to enter an email address, right ?
So go check you mail, you must have got a mail from teh site giving you your login details. Once you logon to the site, you can goto the "Results" tab and then see your results.
Well atlest this is what i did and it worked for me.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

YOu get pinged by a hacker

I put in a dictionary

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The "beep" function mentioned above is an easy interface provided by Microsoft to access in built speakers and manipulate its frequency and the time of sounding. In short abstraction provided by the OS

If you want to do this in Linux....then err.. you are better off asking this question in this forums Linux Section since there is not much info available on the net either.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello to everyone out there.
Want a chance to test your talent.
Go here: http://web.tickle.com/tests/talent/index_main.jsp

The test is a bit lengthy and daunting but is real fun especially for geeks who need to have their daily dose of some insane thinking...

My title:
[IMG]http://img20.imageshack.us/img20/3466/talentresultsvv4.png[/IMG]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Please use code tags to post your code. Enclose your code in code tags.
Also post your entire code so that we can be in a state of answering your questions, dont post half baked snippets.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a fruit jam

I put in all the geeks of the Geek Lounge :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There is no way to return multiple values from a C function. You can get around that by returning an array or manipulating the values by passing them to the function using reference usign pointers.

If you have already decided not to pay attention to what we write then what is the point in helping you out ???

Read my previous post which mentions teh details of how to make the funciton return multiple values by means of passign by reference using pointers. Incorporate the changes which i have made in your program and it will surely accept the data the way you want.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

THe code which you have attempted, makes use of "scanf" for accepting string or char data which normally is not advised since it leaves the input stream dirty and which will cause behaviour which u had not expected.
Better use the technique which i have used while accepting char data and it will always work like a breeze.
Also you have used only one for loop to implement your logic which is not correct since you normally need one for controlling the number of chars to be printed and the second one to actually print characters.

Try somehting like this:

int main()
{
    int i = 0, j = 0 ;
    char buffer[BUFSIZ] = {'\0'} ;
    printf ("Enter the string you want to display: ") ;
    fgets (buffer, BUFSIZ, stdin) ;
    if (buffer[ strlen (buffer) - 1 ] == '\n')
        buffer[ strlen (buffer) - 1 ] = '\0' ;

    for ( i = strlen (buffer) ; i > 0; --i)
    {
        for ( j = 0; j < i; ++j)
        {
            putchar (buffer [j]) ;
        }
        putchar ('\n') ;
    }
   return 0 ;
}

PS:: And by the way my name is not Painkilller, its ~s.o.s~ :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Welcome to Daniweb and a really cool name you have got there :D

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There is no way to return multiple values from a C function. You can get around that by returning an array or manipulating the values by passing them to the function using reference usign pointers.

Try something like this for reference parameter passing:

void input (double* x, double* y, double* z, double* rad)
{

    printf("Please input data for one of the spheres... ");
    printf("X value:");
    scanf("%lf",x);
    printf("Y value:");
    scanf("%lf",y);
    printf("Z value:");
    scanf("%lf",z);
    printf("\nRadius:");
    scanf("%lf",rad);
}

int main()
{
    double x  = 0, y  = 0, z = 0, rad = 0 ;
    input (&x, &y, &z, &rad) ;
    printf("X = %f, Y = %f, Z = %f, Radius = %f  line",x,y,z,rad);
    return 0 ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Walk towards town to kill some time before your house mate gets home.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
double input ()
{
    double x  = 0, y  = 0, z = 0, rad = 0 ;
    printf("Please input data for one of the spheres... ");
    printf("\nRadius:");
    scanf("%lf",&rad);
    printf("X value:");
    scanf("%lf",&x);
    printf("Y value:");
    scanf("%lf",&y);
    printf("Z value:");
    scanf("%lf",&z);
    printf("X = %f, Y = %f, Z = %f, Radius = %f  line",x,y,z,rad);
}

The problem arises bcoz of the "\n" which you place in your scanf stmts. It is a very complex function which is better left off unless its really necessary to use it ( and such condition never arises)

You are better off using something like this:

char buffer [BUFSIZ] = '\0' ;
printf ("Enter a double value: ") ;
fgets (buffer, BUFSIZ, stdin) ;
double value = strtof ( buffer ) ;
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
cout << "/a";

untested but should work. it was something in that direction :P

No :)

Its like

printf ("\a") ;
// or
printf ("\7") ;
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A well detailed Pascal Triangle code snippet here:

http://www.daniweb.com/techtalkforums/post233793-11.html