Narue 5,707 Bad Cop Team Colleague

>but as I know, borland's clrscr calls the system call inside?
Huh? I don't know what you're trying to say, but it's probably wrong and certainly doesn't make much sense.

Narue 5,707 Bad Cop Team Colleague

>system("cls");
Brilliant. So what happens if I replace the Windows cls with my own malicious cls? You've just given me control, thanks! This is what's called a back door, and you left it wide open by using an insecure technique.

Narue 5,707 Bad Cop Team Colleague

>pls if you dont no how to solve the solution above do replay to me
Rash knows the answer, as do many of us, but he's refusing to give it to you because the problem is clearly homework and you haven't shown any effort.

>im seriase pls
I'm serious too. No effort, no help.

Narue 5,707 Bad Cop Team Colleague

IIRC, only mods can see the infractions you've been given.

Narue 5,707 Bad Cop Team Colleague

The best beginner's book I've found for C is "Pointers on C" by Kenneth Reek.

Narue 5,707 Bad Cop Team Colleague

I gave you enough code to understand the solution and complete it. But since that seems to be beyond you, I'll slave over the keyboard for five whole seconds to add one extra line:

int sum = 0;

while ( n <= i ) {
  int save = n * 26 * n;

  sum += save;
  cout<< save <<endl;

  ++n;
}

cout<<"\nSum: "<< sum <<'\n';
Narue 5,707 Bad Cop Team Colleague

>But still it does not generate the required results it printf only one number not the series
That's because you only ask for one number. fab gives you the ith number in the series, not the entire series. If you want the entire series, you need to call fab in a loop:

int i;

for ( i = 0; i < 10; i++ )
  printf ( "%d ", fab ( i ) );
printf ( "\n" );

And you need to start formatting your code. Also, clrscr is declared in conio.h. Your code shouldn't compile until you remove it.

Narue 5,707 Bad Cop Team Colleague

>i am new to C++ and I am just wondering if I can put an array into me code.
The evidence suggests that you can't. Here:

#include <iostream>
#include <string>

using namespace std; 

const int MAX = 2;

struct Person {
  string Firstname, Lastname;
  int grade;

  Person()
  {
    Firstname = "No name assigned";
    Lastname = "No name assigned";
    grade = -1;
  }

  Person ( string l, string f, int g )
  {
    Firstname = f;
    Lastname = l;
    grade = g;
  }
};

int main()
{
  Person a[MAX];

  for ( int i = 0; i < MAX; i++ ) {
    string strFirstname, strLastname;
    int grade;

    cout <<"Enter person's first name: ";
    getline(cin, strFirstname);
    cout <<"Enter person's last name: ";
    getline(cin, strLastname);
    cout <<"Enter the grade: ";
    cin>>grade;
    cin.ignore();

    while ( grade < 0 || grade > 100 ) {
      cout << "Try againand enter a valid grade" <<endl;
      cin >> grade;
    }

    a[i] = Person ( strLastname, strFirstname, grade );
    cout <<"****************************************"<< endl;
  }

  cout<<"The grades are:\n";

  for ( int i = 0; i < MAX; i++ )
    cout<< a[i].Lastname <<", "<< a[i].Firstname <<": "<< a[i].grade <<'\n';
}

Now go read a book.

>i could not figure it out thats why i said it didnt work.
I don't care why you said it didn't work. I don't care if it doesn't work and you want help in making it work. What I care about is that "it doesn't work" is completely unhelpful in troubleshooting your problem. …

Narue 5,707 Bad Cop Team Colleague

>Can u please Correct it I have tried but cant do it
Now I don't understand. I gave you the corrected function. What more do you want?

>Isn't it also a logical OR without the short circuit evaluation?
It can be used as such, provided you're careful. It's generally a bad idea to use the bitwise operators for boolean logic. There can be surprising results.

Narue 5,707 Bad Cop Team Colleague

>can u plzz explain why it prints 0
What's 0 + 0? That's why it prints 0. :icon_rolleyes:

Narue 5,707 Bad Cop Team Colleague

>ok but where would i plug that in my program bellow main?
You don't plug it in, you incorporate it. That means engaging your brain and writing code that works within the current framework of your program or rewriting your program to meet the new requirements.

>when i put it in it would not work.
"It doesn't work" is about the least useful phrase you could possibly utter. If you don't care enough about getting help to properly tell us what doesn't work, how it doesn't work, and what you expected, we don't care enough to help you.

Narue 5,707 Bad Cop Team Colleague

>Where do I put the array?
There's only one place: main. But since you're using std::strings you're probably also in a position to use std::vectors as well. They should be preferred over arrays:

// Other includes
#include <vector>

// Person declaration

int main()
{
  std::vector<Person> v;
  bool done = false;

  while ( true ) {
    v.push_back( get_person() );
    // Some kind of test to break the loop
  }
}

Naturally you need to fill in the blanks and write get_person.

Narue 5,707 Bad Cop Team Colleague

That about covers it. Rep is a superfluous feature, but it is fun occasionally.

>Having said that...how do I access this report?
You can see your rep under the control panel.

jbennet commented: well said - jbennet +11
Narue 5,707 Bad Cop Team Colleague

Close. If num is 0 you return 0, but if num is 1 you return 1, not 0. Also, | is not the same as ||. The former is a bitwise OR and the latter is a logical OR:

int fab ( int num )
{
  if ( num==0 || num==1 )
    return num;
  else
    return fab ( num - 1 ) + fab ( num - 2 );
}

>#include<conio.h>
You don't need this and it destroys the portability of your code. Get rid of it until you know how to use it properly.

>void main ()
This is never correct. The correct definition of main is:

int main ( void ) {
  /* Your code here */
  return 0;
}

>clrscr();
This is unnecessary when working from an IDE and extremely antisocial when working from the command line. In other words, get rid of it until you know how to use it properly.

>printf("Please enter the no yo which You want Fabbnicci series");
It's Fibonacci, not Fabbnicci. You've been told this already. Know how to spell the things you use because you can't do effective research otherwise.

>scanf("%d",&num);
Always error check your input.

>getch();
This is unnecessary when working from the command line and can easily be replaced with a standard solution when working from an IDE. Use getchar instead, it's portable at least.

Narue 5,707 Bad Cop Team Colleague

>do you think that the people who hand the red dots out would be so bold to
>say stuff like that if they knew their names were being attached to
>everything they said?
If they don't have the rocks to tag their names now, I'm sure that automatically listing their names would weaken their comments greatly. ;) I respect people who can voice their opinion openly, and conversely I don't respect people who hide behind anonymity when they flame.

'Stein commented: Agreed. :icon_biggrin: -'Stein +6
Narue 5,707 Bad Cop Team Colleague

>I think it would be fun to ridicule them, as it seems like all the negative
>repping is being done by 1-2 people...
The logic is that if you know who gave you bad rep, you would give them bad rep in return. Personally, all I care about with rep are the comments (I couldn't care less if it's green or red candy), and when people are too cowardly to state who they are, it takes the fun out of reading them.

Narue 5,707 Bad Cop Team Colleague

http://www.yui-net.com/

My favorite is definitely "Good-Bye Days" from that album.

Narue 5,707 Bad Cop Team Colleague

Pfft, admin sticks are all soft and squishy from beating the site into submission. It's the mods in the trenches you should be afraid of. We keep our sticks well honed and practice swinging them to maximize accuracy and damage.

WolfPack commented: amen to that +5
Duki commented: =/ +0
christina>you commented: wow. how dumb -1
Narue 5,707 Bad Cop Team Colleague

Yea, but this guy comes after me 24/7. And I am sick and tired of it.. I will defend myself however I see necessary.

Feel free to flag those posts and the mods will deal with them appropriately. Until you have a flag next to your name that says "Moderator", I'll immediately question your judgment when it comes to defending yourself as necessary. Not to mention that outbursts like your previous one are more likely to get you punished than anyone else.

Okay, perhaps I was out of line. But this guy is constantly dissecting everything I say.. and twisting it to make it appear absurd. I am sick and tired of it..

That's not a good reason to act childish. If he breaks the rules, he's subject to moderation. Otherwise, any "defense" on your part is likely to be crossing the line.

My apologies.. but I do think that some people should lay off the impolite and adolescent remarks. It's your right to disagree with something, but don't constantly pound away at him/her with rude remarks.. It angers people, and makes people not want to come back to Daniweb.

That's a rather hypocritical view, judging from your extremely personal attack on another member a few posts above. In my estimation, you should practice what you preach or refrain from whining about it.

christina>you commented: narue, u think ur somethin cuz ur a mod but no 1 cares. sry! -1
Duki commented: wow, stupid post. +0
John A commented: Excellent, Narue, just excellent. --joeprogrammer +11
Narue 5,707 Bad Cop Team Colleague

I don't see a problem resurrecting the thread in this case.

Narue 5,707 Bad Cop Team Colleague

>1. I did not see the first two ones in the Fibonacci sequence.
Probably because those values weren't printed. They're in the generated sequence though. frrossk's program kind of sucks anyway.

>Also, can you tell me that the a and the i means in this program??
a is an array that holds each number in the sequence and i is the expected length of the sequence.

Narue 5,707 Bad Cop Team Colleague

>Regardless of whether you are using C or C++, moving the '\0' character
>around isn't the solution. (both languages have library functions for string manipulation)
For C that statement is debatable. For a full trim it might be better to do the whole operation in one swell foop, if strncpy worked like you seem to think. You still end up tagging '\0' on the end after the copy or you'll get garbage. Worse, a lot of people don't want a full trim, but either a right or a left trim. In that case your suggestion is suboptimal across the board for a right trim and undefined for both because the memory regions overlap. You would have to use memmove to avoid undefined behavior. So it looks like here you're completely wrong. ;)

Narue 5,707 Bad Cop Team Colleague

>but can any one tell me How the computer Reads it i mean how is the sontrol transfered plzzz
Do a google search for "recursive fibonacci trace". Most of the pages will have at least one image showing you transfer of control within the recursive path.

Narue 5,707 Bad Cop Team Colleague

>Got it?
Please. With that kind of explanation, even I wouldn't get it. :icon_rolleyes:

Narue 5,707 Bad Cop Team Colleague

>if i make it 15 mins iit works out at about £1500 per year
Slacker.

Narue 5,707 Bad Cop Team Colleague

>200.64 isnt a lot.
That's because you break down the increments too small. Anything less than 15 is too small, and a lot of people will tell you that anything less than an hour is too small. ;)

Narue 5,707 Bad Cop Team Colleague

I'm not that petty, and I believe that any rep I give should have meaning to the community. I'd just make fun of you through PM, or in the case of exceptionally entertaining comments, publicly. :twisted:

Narue 5,707 Bad Cop Team Colleague

Generally I require you to read a book instead of wasting my time with a question that can be more quickly and easily researched than posting and waiting for me to reply. But, a += b is logically equivalent to a = a + b .

Narue 5,707 Bad Cop Team Colleague

Latest Reputation Received
Thread Date Comment
New Smileys Apr 28th 2007 6:36 pm cursing is not allowed.

That's a hoot. I wish more people would tag their rep comments so that I could mock them properly. ;)

Narue 5,707 Bad Cop Team Colleague

What don't you understand?

Narue 5,707 Bad Cop Team Colleague

I wasn't ever encouraged, so either I suck at writing tutorials, or no. ;)

Narue 5,707 Bad Cop Team Colleague

Where's the rant and rave smiley? :@ doesn't cut it for my level of bitchiness. Are you trying to tell me something? ;)

christina>you commented: cursing is not allowed. -1
Rashakil Fol commented: I don't see any cursing. +4
Narue 5,707 Bad Cop Team Colleague

>But one thing I've noticed the tutorials are so dull/empty,why?
Probably because not many people are good at writing quality tutorials...

Narue 5,707 Bad Cop Team Colleague

>How much do most people donate on avg?
I donate my time and expertise, so at my usual consultancy rate and a guestimate of about 15 minutes per post, I've donated about $53,000. Add to that the PITA fee of 15% the regular rate and it goes to an even $60,000. I wonder if I can deduct that from my taxes... ;)

Narue 5,707 Bad Cop Team Colleague
int sum = 0;

while ( n <= i ) {
  int save = n * 26 * n;

  sum += save;
  cout<< save <<endl;

  ++n;
}
Narue 5,707 Bad Cop Team Colleague

Please read our rules, FAQs, and stickies before posting. It saves you the embarrassment of making mistake #1 in asking for freebies.

Narue 5,707 Bad Cop Team Colleague

>i read that in C++ some programmers consider using break and continue
>statements as a violation of structured programming practise....... and
>usually avoid using them except in switch statements...
That's because they're stupid. It's like the whole single entry single exit crap that structured programming aficionados spew. The result is theoretically "pure", but it's almost always more complicated and the flow of control is harder to follow. That flies in the face of the best advice I can give: write the simplest code you can get away with.

>i want to know the statement that can replace a break and that that can
>replace continue statement in a program...
A break is generally replaced by a status flag in the loop condition:

while ( [I]something [/I]) {
  if ( [I]something else[/I] )
    break;

  // The rest of the loop
}

becomes:

bool done = false;

while ( !done && [I]something [/I]) {
  if ( [I]something else[/I] )
    done = true;
  else {
    // The rest of the loop
  }
}

A continue is easy to replace by reversing the continue condition and executing the loop logic on the body:

while ( [I]something [/I]) {
  if ( [I]something else[/I] )
    continue;

  // The rest of the loop
}

becomes:

while ( [I]something [/I]) {
  if ( ![I]something else[/I] ) {
    // The rest of the loop
  }
}

It really depends on both your style and what kind of loop you're …

Narue 5,707 Bad Cop Team Colleague

>If you could change one thing, what would it be?
The time it takes for every page to load is painfully slow. Unless I disable advertisements, we're talking on the order of ten seconds from the time the page starts loading to the time I can scoll and click and type without the entire browser application being non-responsive.

The slowness seems to come from the Flash plugin intializing the ads. If I could change one thing, it would be the responsiveness of the site on page loads. That slowness has completely turned me off to Daniweb.

Narue 5,707 Bad Cop Team Colleague

>But anyway, has anyone actually killed Ruby Weapon in Final Fantasy VII?
Yes. Personally, I thought Emerald was harder.

>Any tips or hints or strategies for it?
You're going to lose two members of your party, so make sure that all of them can cast a powerful life and link it to an all materia. Alternatively, you can kill two of the members before going into the fight, but that's kind of a cop out and I don't like to do it. Then just cast knights of the round and mimic it until Ruby dies. It replies with ultima each time though, so you have to heal carefully too.

If you don't have knights of the round, get ready for a really long fight, and victory won't be assured.

Narue 5,707 Bad Cop Team Colleague

>because this homework isn't little, and this part is only a little part.
Rationalize cheating however you want, but we won't spoonfeed you.

Narue 5,707 Bad Cop Team Colleague

>why is this?
Microsoft is pushing their "safe" (translation: cumbersome and completely non-portable) library. You can ignore those warnings because they're stupid and do nothing but clutter up your build. There are two ways to get rid of them. First, you can do it in your project settings under the "Disable Specific Warnings" option by adding 4996. Second, you can use a pragma in your source code:

#pragma warning(disable:4996)

The former is much better because it doesn't alter the source.

Narue 5,707 Bad Cop Team Colleague

>can anyone give me a detailed importance of sun certificate for java programmer???
Anyone asking for a Java programmer will probably want them to be certified. Beyond that, it's a piece of paper and a lapel pin (if they still give you one).

Narue 5,707 Bad Cop Team Colleague

>which C++ though...
The right one, of course. ;)

Narue 5,707 Bad Cop Team Colleague

>Borlan 4.52 doesn't support using namespace std; and #include <iostream> for some reason (HELP!)...
I feel like I'm being ignored. Did you miss the part where I said you would have issues with Borland 4.5 not properly supporting C++?

Narue 5,707 Bad Cop Team Colleague

>and if its old it might not be ANSI C
It's not quite that old. It's a pretty safe bet that any C++ compiler supports ISO C90.

Narue 5,707 Bad Cop Team Colleague

>is Borland C++ free?
It depends on the version. Borland 5.5 is free as a command line compiler, and Turbo C++ Explorer is a free compiler/IDE.

>If I install it on XP, will it have any compatibility errors?
No, but you will have issues with your compiler not properly supporting C++.

Narue 5,707 Bad Cop Team Colleague

If it's called anything, you want a splice. You're splicing a number of nodes out of the list and splicing them into another. Of course, if you don't want them to be removed from the first list, it's a copy rather than a splice.

Narue 5,707 Bad Cop Team Colleague

You should rephrase your question so that you seem like less of a mooch. How about "What's a good book on game programming with DirectX 9.0?"

mattyd commented: seems very petty, not helpful -1
Narue 5,707 Bad Cop Team Colleague

>if you can find any for me tell me please ty
Is it that hard to go to amazon.com or your local bookstore and look? I mean, you look pretty lazy judging by that request.

Narue 5,707 Bad Cop Team Colleague

>Can anyone confirm that it is possible
Yes. Hey, I didn't have to read the rest of your post either! Imagine that...

>Any suggestions, outlandish or otherwise, would be greatly appreciated.
So are you really asking if it's possible or are you asking us how to do it?