Narue 5,707 Bad Cop Team Colleague

>Should you be drinking now you're 'with child'?
Um, last I checked root beer was non-alcoholic. ;)

Narue 5,707 Bad Cop Team Colleague

Wow, now that's service! Can I get fries and a root beer too? :)

Narue 5,707 Bad Cop Team Colleague

Please keep it on the site. Also, we have a forum for job offers.

Narue 5,707 Bad Cop Team Colleague

>An assembler can in principle by its very nature produce code for
>whatever operating system you care to name.
I think you're confused. An assembler produces machine code for the operating system that it's written for. That machine code is non-portable by nature due to varying expectations from the OS, such as object formats. Just because an assembler has builds for multiple operating systems doesn't mean that the machine code produced is portable in any way.

>When you compile a program in a high level language the compiler will be
>inserting a large number of calls to whatever OS it is compiling for.
And when you assemble a program in assembly, you make those calls yourself. The difference in portability between operating systems with assembly and higher level languages is minimal. I don't care if you want to talk about API calls or interrupts. Different systems have different system calls.

But when you are writing in assembler it is you who gets to decide what calls are made to which operating system, so if you want to write an MS-DOS program, which nevertheless makes use of 32 bit registers, and 32 bit variables, you can do it. If you try to run an MS-DOS program under Windows, Windows will switch the processor into what is known as Virtual 8086 mode, and the MS-DOS app will find itself sitting in what seems to it to be an MS-DOS machine, with 1mb of memory, the video buffer …

Narue 5,707 Bad Cop Team Colleague

I've locked this thread due to blatant disregard for posted rules despite my politely asking multiple times for proof of effort. Please read the announcement concerning homework problems.

Narue 5,707 Bad Cop Team Colleague

>Which mode of viewing are you using? linear mode?
That defines how posts are displayed when viewing a thread. I'm talking about the top level view on the forum index.

Narue 5,707 Bad Cop Team Colleague

>my dear i will definetely show efforts .
I still don't see them.

>u can ask holly i have taken help from him and i did
>my remainig problems my self.
I don't care what you've done before, I only care about the questions you're asking now. You see, by my reading, you've done nothing except post the problems you were given verbatim. There's no proof that you've done any work, or any thought at all, and that defeats the purpose of the problems.

Narue 5,707 Bad Cop Team Colleague

It works fine for me, though I doubt that they only have one server for the entire world to use. ;)

Narue 5,707 Bad Cop Team Colleague

This is just a suggestion for a convenience feature. It would be nice if we could collapse the forum categories that we don't use. For instance, I visit the Software Development forums and the Coffee House forums, but rarely anything else. I find myself having to do a lot of scrolling just to switch between the two and see if there are new posts. It would be very nice if we could turn the forum list for, say, the Tech Talk category into just a header. That way only the most relevant forums are visible and extraneous forums that we don't use are hidden. For example, I could probably fit both the Software Development and Coffee House categories on one page for quick viewing if the other categories turned into just a header bar.

Yes, it's a selfish request, but I do think that there are benefits to letting everyone customize their views to their interests.

Narue 5,707 Bad Cop Team Colleague

This is an introductions form. You'll have more luck attracting experts who can help you troubleshoot your problem in the correct forum. This forum would be a good start.

Narue 5,707 Bad Cop Team Colleague

>I feel I was not understood again, propably my fault.
Don't worry about it. Pointers to members aren't exactly a commonly used feature. The problem in your initial code is a type mismatch. x is an array, but to get a pointer to it, you need a pointer to an array member and you were only using a pointer to an int member:

class A{
public:
  int x[10];
};

int main(){
  int (A::*pointer)[10] = &A::x;

  A a;
  (a.*pointer)[0] = 3;
  return 0;
}

Unfortunately, this isn't a case where you can rely on the implicit conversion of an array name to a pointer to the first element of the array. To do that you would need to add another level of abstraction:

class A{
public:
  int x[10];
};

int main(){
  int (A::*pointer)[10] = &A::x;
  int *p;
  A a;

  p = a.*pointer;
  *p = 3;

  return 0;
}
Narue 5,707 Bad Cop Team Colleague

>For example name of contact, instead of typing the whole name I only
>want to use partial--- Kim will pull up Kimmy, Kimlok, Kimm.
I can think of a few ways to do this. The first is autocomplete where you keep track of the characters being entered, search for the string up to the most recent character typed and complete the entry with the first match of that search (the TextBox control supports this feature natively). Next, you can do the same thing except filter the contents of a combo box instead of just using a straight text box. A more user friendly design would probably use a tooltip and/or context menu with suggested matches, but that would take a little more work.

Narue 5,707 Bad Cop Team Colleague

>but how can this be done using 32-bit, since 32-bit is protected by the OS.
Access that functionality through the Win32 API, just like everyone else. It's trivial with MASM (as trivial as anything in assembly can be) because the assembler is written with Win32 applications in mind. Check your help files for example code. :)

Narue 5,707 Bad Cop Team Colleague

Please don't post your homework. We're happy to help with homework, but we won't do it for you. So we ask that you show you've made an honest attempt at solving the problems.

Narue 5,707 Bad Cop Team Colleague

Hehe. "I am important MICROSOFT person!". :lol:

[Edit: Yes! IntelliTXT picked up Microsoft! Ahahahaha!]

Narue 5,707 Bad Cop Team Colleague

>Why is that?
Because there are numerous ways to do the same thing. I just gave you one of them, which might not be appropriate for you. If it turns out to be too slow or take up too much space, then you need to know more, ne? :)

Narue 5,707 Bad Cop Team Colleague

>can anyone tell me if what i have is correct or almost correct
Not to hurt your feelings, but it's not even remotely close. This is a case where I'll recommend that you sit down with your teacher and get some face to face help. It would save us both some time. :)

John A commented: Well said. --joeprogrammer +3
Narue 5,707 Bad Cop Team Colleague

>The resize(x) function was all I needed to know about.
Somehow I doubt that.

Narue 5,707 Bad Cop Team Colleague

I like pi, it's really cool. And I like phi.

Narue 5,707 Bad Cop Team Colleague

>So, any other females here besides myself and Dani
I'm having trouble deciding how to categorize your motivation in asking that. I've settled on one of these three:

1) You couldn't think of anything better to talk about.
2) You're trolling by subtly bringing up a topic that will divide people.
3) You delight in reminding everyone of past prejudices despite their irrelevance.

Narue 5,707 Bad Cop Team Colleague

>You gotta love our new search bbcode
It's a whole new level of catering to lazy people.

Narue 5,707 Bad Cop Team Colleague

>I still have some errors and I can't seem to figure out the mistakes TY for all your help
I refuse to read your code until you format it and put it in code tags.

Narue 5,707 Bad Cop Team Colleague

>I've also tried with fputs but the results were the same...
The problem isn't with your output, it's with your input. fgets stores the newline character. Because only the last line isn't terminated with a newline, it's the only line that prints correctly. Try this:

#include <stdio.h>
#include <string.h>

int main ( void )
{
  static const char filename[] = "file.txt";
  FILE *file = fopen ( filename, "r" );

  if ( file != NULL )
  {
    char line [ 128 ];

    while ( fgets ( line, sizeof line, file ) != NULL )
    {
      char *newline = strchr ( line, '\n' );

      if ( newline != NULL )
        *newline = '\0';

      printf("1");
      fputs ( line, stdout );
      printf("2");
      fputs ( line, stdout );
      printf("3\n");

    }

    fclose ( file );
  }
  else
  {
    perror ( filename );
  }

  return 0;
}
Narue 5,707 Bad Cop Team Colleague

>'d like to know how I can use either string or char to get the user to input 15 or less characters
You can't portably do this. It requires a finer control of the input device than standard C++ supports. However, if you simply want to read lines and truncate the string to 15 characters if you read more than that, it's trivial to do:

#include <iostream>
#include <string>

using namespace std;

int main()
{
  const int max = 5;

  string s;

  // Read lines until the user gets tired
  while ( getline ( cin, s ) ) {
    // Trim the size to 15 if we read too many
    if ( s.size() > max )
      s.resize ( max );

    // Make sure it worked
    cout<< s <<'\n';
  }
}
Narue 5,707 Bad Cop Team Colleague

>Could someone please tell me how Sparse Matrix structure is different from a List?
A sparse matrix is like a two dimensional list that doesn't waste space on empty cells.

Narue 5,707 Bad Cop Team Colleague

The point of the questions is for you to do the analysis and come up with an answer. Any loser can find the answer by exhaustively searching for it online (well, maybe not any loser ;)); a promising computer scientist, as I'm sure you are, isn't afraid to figure it out for himself.

Narue 5,707 Bad Cop Team Colleague

>1) Do big-oh and theta both represent the worstcase for the running time?
They represent whatever case you're analyzing.

>2) How do I know when to use theta?
Theta is when you can achieve it. It's a much stronger claim than Big O because it's a tighter bound.

Narue 5,707 Bad Cop Team Colleague

>1) What are the prospects for a female in this field and will her age be a hinderance, meaning to old to start?
Age and gender are irrelevant. The big killer will be her lack of mathematics skills. While some programmers can get away with basic arithmetic, programming is inherently based on algebraic concepts and notations. At the very least, a programmer should be familiar with algebra. Game programmers will have better luck with a strong foundation in geometry, calculus, and trigonometry because that's one of the more demanding fields.

>3) What is the demand for software engineers like and average starting salary?
Good developers are always in demand. The starting salary varies on the region, but in Atlanta an entry level programmer can expect to start around $40K.

>4) Should she persue a degree in computer science or engineering and
>what will she need a bachelor's or master's?
At least a BS is computer science will help immensely in getting a job. Naturally, the more education and experience she has, the better off she'll be. But time is usually an issue as well, so she'll have to use her judgement on when to stop taking classes and start learning from actually doing the work.

>5) Is the field highly stressful or laid back?
It depends on the field and the employer. My employer lets us be laid back, but the work is extremely demanding. It's good stress because it keeps us …

Narue 5,707 Bad Cop Team Colleague

>What would you do in such a case?
It depends on how far you want to go. If you simply don't want to be associated with the project, you can turn it down at the risk of losing your job. If you feel the project should be cancelled, you can fight a lot of battles to get it cancelled (very likely losing your job and/or going through a lot of unpleasant experiences in the process), keeping in mind the slim chance of success.

Perhaps a better route would be to accept your assignment and attempt to improve the game. However, an ethical developer is aware that other opinions exist and is tolerant of them. These things are very much a matter of perspective, and if you're not careful, you could easily cross lines that shouldn't be crossed.

~s.o.s~ commented: Welcome back Miss Narue, hope you let bygones be bygones and stay a bit longer this time -- ~s.o.s~ +7
Narue 5,707 Bad Cop Team Colleague

>Is it better to just to individually declare the members of std to be used in
>a program, or is the global declaration "using namespace std" being
>unjustly maligned as a "global polluter".
Yes and no, respectively, but with one caveat. The big problem comes from dealing with the global namespace. The reason it's a big problem is because you can't expect everyone to know every name being used by the standard library. I've had to fix quite a few bugs that stemmed from using a standard name without knowing it. So this code is potentially dangerous for the same reason that a poorly named global variable is potentially dangerous:

#include <iostream>

using namespace std;

void foo()
{
  // Might unintentionally use standard names
}

int main()
{
  // Uses unadorned standard names
}

However, just as with global variables, the problem becomes virtually non-existent when you shrink the scope. The following is much better:

#include <iostream>

void foo()
{
  // Might unintentionally use standard names
}

int main()
{
  using namespace std;

  // Uses unadorned standard names
}

By restricting the scope in which you open a namespace, you can localize problems more easily. For clarity sake, it's always better to be explicit. So instead of dumping the bucket, you would have a using declaration for each name that you actually use.

Narue 5,707 Bad Cop Team Colleague

>Can you understand that?
Probably more clearly than you do. I also understand how your recommendations could do more harm than good (and no, I'm not a Microsoft hater). Do you?

aeinstein commented: I was looking to give you a green dot, but when you failed to follow-up your admonition with an explanation I had to give you a red one instead. Maybe next time! And no, I'm not CSCGal. -2
Narue 5,707 Bad Cop Team Colleague

>Well, apparently you've never heard of my school.
Apparently every school on the planet is incompetent, because your "problem" seems to be the norm. :rolleyes:

>I'm not looking for someone to do my homework for me. I just need a hint on where to start.
If I were you, I would take some of the knowledge obtained from my Java courses and apply them to C. The meat of programming is language independent, so you really can't use the "I know Java but not C or C++" excuse.

First, you need to understand the problem. Then you need to work out the steps for solving the problem, preferably on paper and completely by hand. Even a "complete beginner" such as yourself should have little trouble working out the basic steps in an unfamiliar language with a complete understanding of how the solution should work.

When you have a specific problem (ie. something besides "I don't know where to start"), I'll be in a better position to help you.

Narue 5,707 Bad Cop Team Colleague

>I'm not lying!
Sure you are. Are you trying to convince us that some school actually gave a complete beginner code and logic that would typically be reserved for second or third semester programming courses? Your post shows all the signs of a slacker who's suddenly facing a failing grade for his laziness.

We'll still help, but you're going to need to do more than just show us code that your teacher probably gave and in a lame attempt to appear as if you're doing work.

Narue 5,707 Bad Cop Team Colleague

>if (gallons == a - z || A - Z){
There are several things wrong with this. First, you're testing the value of characters, so you need to be surrounding them with single quotes. Next, you need to recompare with every part of the expression. C isn't polite enough to assume what you're doing. Third, your logic is faulty. And finally, testing gallons against a character is doomed to failure because it's a float. If it were a character, you could do this:

if ( gallons >= 'a' && gallons <= 'z' ||
  gallons >= 'A' && gallons <= 'Z' )
{

However, in reality, you have two choices to validate a float. First, you can use the return value of scanf, which is (put simply) the number of successfully read values matching the format string:

if ( scanf ( "%f", &gallons ) != 1 ) {
  // Invalid input
}

The second way is much better. Read all input as a string and validate it while in memory. Then when you're sure that it's legit, you convert to the appropriate type. That's probably too advanced of a solution at this point, so you'll probably want the scanf solution.

Narue 5,707 Bad Cop Team Colleague

>I'm completely new to C++, and my teacher gave us a card game to do for our first assignment.
One of these statements is a lie.

Salem commented: spreading rep - Salem +3
Narue 5,707 Bad Cop Team Colleague

I seem to have struck a nerve. Could it be that I caught you advertising and you're trying to put a charitable spin on it? :lol:

Narue 5,707 Bad Cop Team Colleague

>the compiler says the functions I am using are deprecated
My copy of the standard says no such thing. This is one case where it's okay to use a pragma to make the compiler shut the hell up.

Narue 5,707 Bad Cop Team Colleague

>printf("%c", len_char); //<----this does not print anything too!!
What did you expect it to print? You realize that the %c format modifier takes the integer value you supply and prints the character representation of that integer, right? In other words, it's not going to print '3'...ever. As long as the lengths are single digits, you can say len_char + '0' and get the correct representation, but once the length exceeds 9, you're SOL with this method.

WolfPack commented: お帰りなさい。 +4
Grunt commented: So here comes back the great Narue- [Grunt] +2
~s.o.s~ commented: welcome back Miss Narue [~s.o.s~] +3
Narue 5,707 Bad Cop Team Colleague

I can sleep tonight knowing that I was wrong in my way of thinking! Women and men are equal here and everywhere else!! Thank you!! I have seen the light!! Goodnight!!

Either that was excessive sarcasm, or you really need to switch to decaf. :rolleyes:

Narue 5,707 Bad Cop Team Colleague

>So, why are they getting such bad press?
That's news to me. All the press I've seen or participated in has been good. Do you have links to this "bad press"?

>Women programmers are much too few and far between.
Are you saying this because there's a legitimate and measurable deficiency because of the lack of women? Or are you just trying to be some sort of feminist snob?

>And the reason for nearly all computer games being so violent? Because they are programmed by men!
Absolute BS. This comment actually made me laugh out loud, which is hard to do. Programmers write what they're told to write. Most of us don't have the option of picking and choosing, and we certainly don't have a strong influence on market trends. Many games are violent because consumers like violent games and game companies pay their programmers to write games that comsumers want.

>Just a note, I wonder what the ratio of men to women on this site alone is?
Predominantly male, just like everywhere else. This shouldn't come as a surprise at all.

>Anyway, sorry to sound off like this (and maybe a little sexist?)
You sound ignorant and annoyingly opinionated without facts to back up your statements, but not sexist.

>When was the last time you heard of a woman programmer?
I work closely with one on a daily basis. :rolleyes:

>When was the last time that a …

Narue 5,707 Bad Cop Team Colleague

This has nothing to do with C or C++. Please direct your question to a Linux forum.

Narue 5,707 Bad Cop Team Colleague

>you might be interested in using the Visual Studio Express Edition products.
I only have one question: How much is Microsoft paying you to promote their stuff on random forums?

Narue 5,707 Bad Cop Team Colleague

I refuse to look at your code until you format it like a normal human being. It would also help if you'd stop acting like a wuss and ask a smart question.

Narue 5,707 Bad Cop Team Colleague

>but i have seen in many others threads people have asked to write
>codes even some people have asked to write there code give in there assignments
And in how many of those threads did those people get flamed for it? I'm willing to bet pretty much all of them.

>but he/she can also make me understand the logic behind the that algorithm...
Yes, but you asked for code. That suggests that you're making no attempt to understand the problem or solve it for yourself. A better way to post would be to ask for help understanding the problem, while specifying things you've already tried. At least that way we know you've tried to think for yourself.

Narue 5,707 Bad Cop Team Colleague

Presumably, mvwprintw is just a wrapper around some form of printf, so unless you want to look at your documentation, we can only assume that the format modifier follows the same rules.

The asterisk means that a value will be supplied as a later argument. The first asterisk is the field width and the second is the precision. I'd recommend testing how it works by hard coding values. For example:

printf ( "%5.2s\n", "abcdefghijklmnopqrstuvwxyz" );
Narue 5,707 Bad Cop Team Colleague

>who are you to decide this ??
The forum rules decided this and the community enforces it. If you have a problem with that, leave.

Narue 5,707 Bad Cop Team Colleague

>I'm thinking that the learning curve for this stuff is a lot higher than I expected
That's very likely.

>I feel like I should be able to just jump right in
After a couple of years of learning you can jump right in and still be overwhelmed. There's really no such thing as a comfort zone when it comes to real world programming. ;)

Narue 5,707 Bad Cop Team Colleague

Pascal's triangle is boring. How about something more fractalish:

#include <iomanip>
#include <iostream>

using namespace std;

int main()
{
  int rows = 16;

  for ( int i = 0; i < rows; i++ ) {
    cout<< setw ( rows - i - 1 ) <<"";

    for ( int j = 0; j <= i; j++ )
      cout<< ( ( ~i & j ) ? ' ' : '*' ) <<' ';

    cout<<'\n';
  }

  cin.get();
}

>Here i am trying to design a custom pascal triangle where the user can
>specify the TOP ELEMENT as well as both the CORNER elements.
That's not very logical. Can you give a few examples?

>Err...
>Please elaborate if possible.
Take note of the ncr function:

#include <iostream>

using namespace std;

double factorial ( double n )
{
  return ( n > 1 ) ? n * factorial ( n - 1 ) : 1;
}

double ncr ( int n, int r )
{
  return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) );
}

int main()
{
  cout.setf ( ios::fixed, ios::floatfield );
  cout.precision ( 0 );

  for ( int i = 0; i < 15; i++ ) {
    for ( int j = 0; j <= i; j++ )
      cout<< right << ncr ( i, j ) <<' ';

    cout<<'\n';
  }

  cin.get();
}
Narue 5,707 Bad Cop Team Colleague

>What is the Importance and uses of data stuctures in Programming using C/C++ when using it?
That should be intuitively obvious. Data is critical to programming and storing that data in effective ways is equally critical.

>How Stack,Queue,and list works and give example problem that solve stacks
This reeks of homework. As such, I'll fall back on the usual answer of "show me yours and I'll show you mine".

Narue 5,707 Bad Cop Team Colleague

Because you're just swapping addresses, not values. You want to dereference the pointers:

void f( int *a, int *b)
{
  int temp;
  temp=*a;
  *a=*b;
  *b=temp;
}