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

Just on an ending note, wanted to point out: system("pause") ; // dont use this function, its non portable and expensive call cin.get() ; // use this function instead

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

Need speed, C++. Just need a GUI to access a DB, VB would be my choice.

Why not use a third party library to access the database using C++ and build the GUI using GTK+ or wxWidgets ?

No point in learning a new lang, and that too VB !!! It would be better if you invest your time in Python or something like that.

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

Hmmm how about something like:

int hours = 0 ;
for( int i = 0; i < 3; ++i )
{
   cout << "Enter the hours parked: " ;
   cin >> hours ;
   // call your function and display the output in the format you want.

  // do whatever processing you want to do.

}
// end the for loop
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sshh.. dont say things like that, otherwise he would again fly in rage and say that you are personally attacking him. :D

And btw the article posted by Mr. Rashakil goes out to show that one language is always powerful than other. (thats what i got from the article).

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

Heh, considering that you use the feature to let us know about it, it has its uses and it wouldnt be considered as forced usage since it has helped us. :D

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

Some of these comments remind me of the Blub Paradox

A really good read. I like it.

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

Hey there, this is the second time in a row you are bumping an age old thread. Please see the date of the last post before posting new content. The OP is no longer interested in this topic.

Thread closed.

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

I am closing this thread since it was opened reagarding a two year old query by someone.

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

On a completely different note, this thread has been open for ages! Is it possible to get a conclusive vote/poll on here? :/

Naa.. not possible especially when it is realated to some language. The result will always be a biased one.

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

You attacked VB programmers in general, implying that their art is "child's play" you also took on an air of superiority in your comment:

Bah, air of superiority. I never would go to such lengths. I respect all genres of programmers and was narrating the experience of my friend, who had a tough time doing the transition. I dont watn to be beaten up by the whole VB. NET forum for doing something like that. :D

Which I decided, perhaps wrongly, was directed at myself. My reply was strictly a technical comeback, and not wrongly taking something personally. Had I taken it personally, I would probably not have replied. However, I felt, from a technical standpoint, it was right, or at least acceptable for me to contradict your comment. =))

Point well taken in .

All peace and if it makes you happy, *damn it* long live VB programmers.:mrgreen:

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

Hey first of all, "there was no personal attack in my post". Highlight the section in my post which shows it.

I would ask you to stop taking it personally and I definately dont doubt your abilities coz i dont know you personally. You might have being the project leader of Warcraft , I dont know.

I specifically ended my two posts saying:

Just my 2 cents.

My own belief, no one can control that.

just to let you know that its a matter of personal preference.

Everyone choses whatever they like. I dont have any control over them.

And whatever was stated by me in previous posts was just my own personal experience. Of course there is no perfect lang or best lang for any task. Maybe even i would have to do VB someday as a part of project, I would do it.

But Personal liking is a different matter.

And please "stop taking this personally".

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

You have completely missed the point or havent read my post carefully.

But expericence has shown me that you cant just bring back someone from the otherside so if someone is a VB or Actionscript proponent, nothing can convince them against it.

I have always considered VB and its peers likes a childs play.

Just one simple point:
A C programmer can easily adapt himself to VB -- for him it will be a piece of cake, but someone who has always loved VB will bleed to death figuring out why the hell do you need the address of a variable.

But before it turns out to be a lang war just to let you know that its a matter of personal preference.

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

Hmm.. buddy, just post the kind of error you are getting or the way your program is supposed to work and is not working or atleast some indication which will tell us whta you need to know.
You are very vague in your question.

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

Actionscript is not actually a language since it comes with a proprietary package of Macromedia Flash. In the flash universe it can be regarded as a language but in generic terms, no.
It is an addon added to flash to get better control over the components and their behaviour.

Just my 2 cents.

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

I bet it is probably a puzzle given by the professor to confuse the students in which case it is not necessary for the inner printf to print something meaningful.
I think he wanted to stress the point that printf returns a value and that is equal to the number of characters printed.

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

You were just asked to specify your requirements in a more specific manner and what you do is start a fight about ego.

Judging from your reply, its "you" has got a lot of ego coz instead of clarifyign the situation you just act like a kid and blame the moderators who try to help you out.

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

LOoks like your concept of array indexing is a bit shaky.
If the array is declared as int binary[10], it contains 10 elements which can be accessed using binary[0] to binary[9].

If you use binary[10] you would be handling memory which doest belong to you and its called out of bounds exception.

for (i=9; i >= 0; i--)
        {
               binarySum[i] = binary1[i] + binary2[i] + overflow[i];

  // binarySum has indices from 0 to 8 since it has size 9
     // your very first iteration attempst to modify the 10th element
     // i.e. binarySum [9] which is not actually there.
     // the same problem is with your other arrays

            if ( binarySum[i] > 1)
                {
                    overflow[i-1] = 1;
                    binarySum[i] %= 2;
                }
        }
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes very much possible, but you just have to modify the existing a bit.

But I aint attempting it for you. For you to be a good programer, you have to try it yourself and if you get stuck i will help you out.

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

Is your friend a well known software engineer or is there any specific reason you should listen to him ?
If he is a student just like you then you would be better off gettign your thoughts clarified at the forums rather than getting all the wrong ideas from each other.

And as far as the line char name[BUFSIZ] = {'\0'} ; It creates a character array name of size BUFSIZ which is a constant defined as #define BUFSIZ 512 in the standard library.

And by following it with {'\0'} , i am initializing all the elemnts of the array to null value i.e. '\0' .

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

I get two values not one.
BTW printf returns the number of characters it has printed and the inner statement is always executed first though it is not wise to assume the order of execution.

Try this program:

int main()
{
    while(1)
    {
        if(printf("%d",printf("    %d"))) // the inner printf prints 5 chars and hence returns 5
            break;
        else
            continue;
    }
}

//My output:
//    05
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Everythign is possible using a third party graphics library.
Research and you will find a lot of them out there.

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

To get around this problem, try placing the literal value before the variable while comparing.
Something like:

while( true == check )
// here if you make a mistake of using an assignement operator
// an error will be flaged
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The code which you posted doesnt even compile. Try to post error free code which will help us find you a solution quickly. Also the changes which i had asked you to made werent totally made. Why keep two while loops i dont know ?

Here is the slightly updated code. Compare it with what you had posted and see where you had made mistakes.

One more thing:

1. main returns int so dont use main() use int main( ) 2. Try to keep the qualifiers list of scanf clean otherwise you are in for a lot of surprises. If possible dont use spaces in scanf while accepting input unless necessary.

#include <stdio.h>
int main()
{
    int height = 0; // if possible initialize variables while declaering them to avoid subtle bugs.
    int width = 0;
    int count = 0;

    printf( "Enter the width of rectange: " ) ;
    scanf("%d", &width);
    printf( "Enter the height of rectange: " ) ;
    scanf("%d", &height);
    putchar( '\n' ) ;
    while( count < (height * width) )
    {
       if( count % width == 0 )
          putchar( '\n' ) ;
       putchar( '*' ) ;
       ++count ;
    }
    putchar( '\n' ) ;
    return 0 ;
}

Hope it helped, bye.

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

Post your code using code tags ( read the forum announcements )

And what exactly is the problem with the given code. Be specific.

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

Dont you think the check part written by me for your previous post is a bit er.. easier and simpler.

Why not have a look at it here:
http://www.daniweb.com/techtalkforums/post266165-5.html

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

But he says thatst the way his assignment is supposed to be.
Othewise the implementation of stack will never contain an array of viod poitners in its class defination.

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

I am not getting any errors on my compiler. I am usign MingW compiler.

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

IT is better to initialize the values while declaring them to avoid these type of small bugs. Do somtthng like this at the startt of your program and it should work out fine.: int number = 0, maxnumber = 0, total = 0;

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

Anwer to your question has alread been anwered by Mr. WaltP.

// What is the starting value of total? It isn't 0. You never initialized it

Incorporate that change and post your code in code tags so it is in readable form. See the forum announcements for it.

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

I vote for new window.

Maybe you would want to consult the super mods or the other moderators before implementing this new behaviour if you still havent decided somethign yet.

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

Hmm yeah this thing has even happened to me quite a number of times..

Which browser you use Mr. Andor, i use Firefox ?

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

Hmm.. ok I will put another senario in front of you.

I read the post, do the research, get stuck again (which is almost natural) and then open up another window, reload the Daniweb home page, goto C++ forums, try to find the one posted by me, open it, then start describing the problem.

Tada... isnt this a herculian task :D

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

Naa.. what i meant was when the green underlined link is clicked, the result be shown in the new window and not "all these things opened in new windows" like you said.

If my research takes a lengthy toll, and it takes somethign about 10 pages to get the result, would it make sense to open the google or daniweb snippet page in the same window ?

Hitting back button 10 times may seem like a herculian task to someone, especially if i am on a dial up connection where each page transition would not be so smooth.

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

Yes it seems more logical that way.

Though i agree there is a back button, it jsut seems to take the focus off the original content i.e. the reply posted by someone else to help me out.

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

The same here. Not opening.

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

Hmm.. cant wait to test it out and see how it works.

BTW for what all langs this feature has been added ?

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

I tried this but am confused and received errors. I am trying to get an out put that look like this when complied and the user input a number:

say the user inputs 15 for the number; then there woud be a square made up of * 15 accross top and bottom and 15 down each side.

The code snippet I posted is perfectly alright and just requires data from the main program or the driver program to print the result on the screen. Are you sure you have written the prog as I have pointed out.

Post the code which you have attempted and then maybe i can help you out.

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

Although I expected it to keep going in further and show the Milky Way again...

lol

You joking right !!!!

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

Hmm.. k now follow closely.
Suppose the character under consideration is the char variable my_char. You want to encrypt "z" and my_char is currently is the character 'z'.

1. Just to point out to you that char values are actually integers ranging from 0 to 255 ( 8 bits ). And according to the standard ASCII table the integer value for 'a' is 97 and 'z' is 122. So working with characters is actually working with integer or pure numbers.

2. What you want is to encrypt the char by addign one to it -- so first we will follow that step. my_char + 1 // this will give the required char 3. THe above process will work fine from 'a' to 'y' but when 'z' is encountered we want to loop back. So the extra work is required for this.

4. Next i do (my_char + 1 - 'a') % 26 This step is called normalizing or brinign the result in the required range that is from 1 to 26 ( here a -> 1st char, z -> 26 th char )

5. Now the output which i get will always be in the range of 0 to 25 irrespective of the character considered (try it out yourself and you will see)

6. But for our purpose we want actual char values and not normalized values so we again add 'a' to the whole result so that the result obtained are character values …

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

Definately cooool.

Must see for all. Great work Dude

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

1. First of all main returns int so your prototype should be int main (void) with a return 0 at the end of the program.

2. You wanted a square of * but you ask the user two parameters width and height , so do you really want a square or a rectangle.

3. You are using while loop the wrong way... use nested for loops to achieve the same purpose.

for( i = 0; i < height; ++i )
{
    for( j = 0; j < width; ++j )
    {
         putchar( '*' ) ;
    }
}

// or to modify what you have done..
count = 1 ;
while( count <= (height * width) )
{
   if( count % width == 0 )
      putchar( '\n' ) ;
   putchar( '*' ) ;
   ++count ;
}

Hope it helped , bye.

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

1. To make the program modify only characters you can use the function isalpha ( my_char ) which accepts a character and returns true or non zero value if the char is a alphabetic character. Thus before encrypting the character check the char using this function and it should work fine.

2. To make the program loop back from 'a' to 'z' you have to use some ascii mathematics... ((my_char + 1) - 'a') % 26 ; This should do the trick for loopback.

Consider my_char = 'z' then
(( 'z' + 1 - a ) % 26) + 'a' => 26 % 26 + 'a' => 0 + 'a'=> 'a'

HOpe it helped, bye.

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

Hmm.. i am not sure that i have got your question but:

int main( void )
{
    char name[BUFSIZ] = {'\0'} ;
    printf ( "Enter the string: " ) ;
    fgets( name, BUFSIZ, stdin ) ;

    int i = 0 ;
    for( i = 0; i < strlen( name ) - 1; ++i )
    {
        name[i] = name[i] + 1 ;
    }

    printf( "%s", name ) ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Mybe something like:

string my_string = "1234" ;
long i = strtol( my_string.c_str() ) ; // long = 1234

Hope it helped, bye.

~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

Hmm anything for a good friend...

Done and done. It would be better if you pasted your request in your signature, that way more ppl will vote for that.

PS: BTW who is the girl Lauren ;)

'Stein commented: Thanks again :) -'Stein +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Static functions are functions which have no implicit "this" argument, can access only static data members and can be called with or without instantiating a class.
eg.

class Shape
      {   
   static double trans[2][2]  // a transformation matrix
   // ...
       public:
   static void scale(double s);  //multiplies trans with s
      };

// The above can be called as
   Shape::scale(0.5) ;
   x.scale(0.5) ;  // x is the instance of class

And as far as good C programs are concerned, you can find the best C resources HERE

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

Hmm..

Dungeon Siege I & II
Neverwinter Nights
Gothic II
Diablo II
Severance -- The blade of Darkness
....

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

Hmm.. I agree. Sad but true.

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

just to put you on the right path i am going to give a crude example of how it can be done using simple nested loops. Just understand the logic and implement it accordingly.

But it was not like i didnt warn him :D