Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

While I am not a mod, and thus have no formal standing here, I would like to point you toward the Daniweb Forum Rules, specifically this one:

  • Do not hijack old forum threads by posting a new question as a reply to an old one

I suspect that this one might apply as well:

  • Do provide evidence of having done some work yourself if posting questions from school or work assignments

If you have a question, you would do better to create a new thread, rather than resurrecting one which has been dead for two years.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Sorry about that... anyway, it isn't entirely clear what you are asking, here:

what should I pass while executing C program...below is my code

Could you elaborate on this, and maybe give us a bit more detail on what the program is meant to do?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Before trying to understand what you need help with, I want to make a comment about the code itself. I will try to address your question - to the extent that you asked one at all - in a follow-up post, but I wanted to get this out of the way. Feel free to skip this if you don't care about writing good code.

This line shouldn't compile on any compiler that isn't older than I am guessing you are:

main() {

While the original K&R C allowed for default function return values, since the late 1980s the C standard has required a return type declaration. In the case of main() that type should always - always, regardless of what certain older compilers allowed - be int.

Some older compilers allowed default return types up to the late 1990s (usually with some sort of warning), in order to ease the updating of older code, but most newer compilers will reject this code. I am guessing that you are using Turbo C, however, in which case my advice is DON'T.

Aside from the fact that Turbo C is 30 years old, and does not support any of the changes to the language made since 1989, it also has the glaring fault in that it allows main() to be declared as type void. This was based on a misunderstanding of the proposed standard which was still being debated at the time Turbo C 1.0 came out, and later versions of the …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Fair enough. I've been in a similar situation more than once myself (both for VB6, and for other old languages and systems), so I understand how that goes. Maintaining legacy apps is its own weird little world.

rproffitt commented: Stay weird, get paid. +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

The question doesn't make much sense to me. What is it you are trying to install, and why does it require you to use VB6, of all things?

Also, if this has anything to do with the other post, regarding Android apps... well, you are very much in the weeds on that. VB6 - both the compiler itself, and the applications made with it - only worked on Windows, so writing anything in VB 6 for any mobile platform - including Windows Mobile - is a non-starter.

Note the past tense, as (to the best of my knowledge) the VB6 compiler does not run on versions of Windows more recent than Vista (which, as a point of reference, was released in early 2007). This may only apply to 64-bit editions of Windows, though, so I am not sure. Can anyone else clarify this point at all?

Either way, using a 20-year-old compiler that is no long officially supported by its creators is not something I would recommend in the first place. Unless you are maintaining legacy VB6 code, I would recommend finding something else - VB .Net would be an obvious choice, but Python, Ruby, Java, or C# are all options, I would expect - assuming you have a choice in the matter, which I know might not be the case.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

You're missing the important point: no one on this forum is going to do it for you.

This forum is for people who want help with a problem when writing a program. The forum for people who want someone else to do some programming for them is the Hiring forum, but that generally will cost you money.

So, if you aren't actually doing the programming yourself, you can go over to the Hiring forum and offer to pay someone to do it, but that's not what the Programming forums are for.

I will also add that if this is a homework problem, then you shouldn't even bother going there - the forum rules specifically forbid asking or paying someone to do an assignment for you (you can ask for help, but not for a hand-out). I don't think that this is the case given what you are asking for, but it is better to add that now to make the point clear.

I realize that you are probably new to fora like Daniweb, so you probably deserve some leeway on all this; besides, I am not a moderator myself, so I can't do anything except give advice. But now that I've explained that you are going about things the wrong way, I hope you will be willing to listen to what I have said.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

To the best of my knowledge, the API key has always been required, but that's beside the point.

The reason it doesn't work in PHP pages is because there is no such thing as a 'PHP page'. There are PHP scripts, but the pages themselves aren't PHP, they are script-generated HTML (and maybe script-generated CSS and/or JavaScript along with it).

PHP runs entirely server-side, and its primary output is an HTML page that gets sent to the browser. Once it is at the browser, there is nothing to show that wasn't a static HTML page all along, save for file extension in the URL - an extension that is there solely to tell the server that it has to pass the file to the PHP interpreter and then serve the output of the script instead of the file itself.

There may also be client-side scripting, using JavaScript (or some other web-scripting language which the browser might recognize, though JavaScript is the closest to being universal), but that's a separate topic. None of the PHP code goes to the browser, so anything that needs to run client-side has to be something else - even if that client-side script was itself generated by the PHP script.

So why doesn't the API key work in a PHP script? Because by the time the key is used, the PHP script has already run its course. You can't use an API key in a script that is no longer running, and when the script …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

That modification would be a a good deal more than 'a little bit'.

You seem to have misunderstood what this forum is for: it's for people who are trying to solve a programming problem themselves, and need a bit of help. In other words, it is about programmer helping each other.

This doesn't include giving free work to someone who has no interest in doing any programming on their own, or who are simply being too lazy to do their own work. If you aren't doing any programming yourself, or expect someone else to do your programming for you out of the goodness of their hearts, you are in the wrong place.

If you want to hire someone, we have a separate message board under the Community Center for that, but don't expect anyone to do this for free just because you ask them to.

You might be able to find someone who is playing this game themselves, and would do it out of their own interest in the project, but the odds of that are pretty low. You might find someone who will take it on just for the challenge of it, or for cred among other FOSS developers, but that's even less likely. I doubt anyone else would work on it without some kind of motivation, and for someone with no stake in something, that motivation usually involves money.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

As DDanbe said, we'd need to know what 'error 106' meant here. However, I think we can elaborate on that to make something of a teachable moment.

First, before I address that, I will point out to you that when you post code samples here, you need to indent every line of the code by at least four spaces, or the formatting won't be preserved. I suggest reading the docs for the Daniweb version of Markdown for a more detailed explanation.

With that out of the way, let's get on with the show.

While it isn't entirely clear without more context, it is safe to guess that the '106 error' is a compiler error message, that is, a report of a problem in the code that indicates a fatal error - something that prevents the compiler from finishing the compilation.

It also could be a compiler warning, which indicates something that could be a mistake, but isn't serious enough to be a showstopper - something which the compiler isn't sure is a problem, but thinks you should look into. Or, since you didn't say when it comes up, it could even be an error message that you get after it is compiled, when the program is running.

But the safe bet is that it is a compiler error message.

This means we'd need to know which compiler you are using. Different compilers - even for the same language - will have different error and warning messages and codes, …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

This problem is most often given under the name "Fizzbuzz", being based on an old children's math game of that name, but as Rev Jim said, it is a problem that a lot of professors use as a check on how well students understand the material, as well as being a favorite of lazy interviewers who don't realize that anyone who has been programming for a few years will have seen it before (to be fair, it wasn't a bad choice fifteen years ago, but today it has been done to death).

A quick web search on the first line of the problem statement should have found literally thousands of relevant hits, even without the usual name attached, so the fact that the are asking this at all indicates a lack of effort. Note that the name 'Fizzbuzz' comes up in one the first

Presumably, changing the words from "fizz" => "FOO", "buzz" => "BAR", and "fizzbuzz" => "BAZ" was to throw off a simple search (as 'foo', 'bar', and 'baz' are standard metasyntactic variables, and searches on them would get a lot of other things instead of the Fizzbuzz problem), as well as keep you from using one of the more common approaches to the problem (one which works for the usual problem, but doesn't scale).

Now, Fizzbuzz is indeed a deceptively tricky problem; that's the whole point. It is not one that really demands much in the way of design …

rproffitt commented: Bizarre implementations? How else to avoid being called out for plagiarism but to make the most bizarre solution? +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Has your course covered either while loops, or for loops, yet? It would be very unusual for a class to cover repeat...until without covering those first.

For a quick thumbnail sketch: while is pre-conditional indefinite loop, that is to say, is repeats based on a conditional test that is first tested at the start of the loop.

     a := 0;

     while a < 1 do
     begin
         readln(a);
     end;

It is basically the same as repeat...until, except that repeat...until always runs the body of the loop at least once.

By contrast, the for loop is a definite loop, meaning it repeats a fixed number of times - either counting up, or counting down.

For example, counting from 0 to 10 would be:

     for i := 0 to 10 do
     begin
         { do something here }
     end;

while counting down is

    for j := 10 downto 0 do
    begin
        { do something else here }
    end;

Note also that you can have nested loops, that is, a loop with another loop inside of it:

    For j := a DownTo 1 Do
    Begin
        For i : = 1 To j Do
        Begin
            {  do something here }
        End;
    End;

You will also notice that Pascal is case-insensitive, meaning that for, For, FOR, fOr, etc... are all the same keyword. You can use the style you want, or at least the one your professor requires, but you want to know that it can vary like this.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

You say,

I have been programming C# for some time,

and

i recently learned about constructors and objects

Unless 'some time' is 'under an hour', these two statements are contradictory.

If you are new to C# programming, either learning it on your own or as a student in a course on the topic, we will understand, and be happy to help. However, if you try to present yourself as experienced in something when you aren't, that sets up expectations which will make it harder for us to help - we won't be able to judge what kind of explanation to give.

And if you try to pass off homework problems as something else, well, that's a Problem, as it is a direct violation of the Daniweb Forum Posting Rules, specifically this one:

  • Do provide evidence of having done some work yourself if posting questions from school or work assignments

We can forgive it once, as you are a new member who isn't clear on the rules, but please don't try it again.

rproffitt commented: +1 for putting it nicely. +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

@raj_30: Permit me to point you toward the Daniweb Forum Posting Rules before proceeding, as you just broke some of them. As a new member, you will be forgiven - mostly - for these mistakes, but you really don't want to make one of the regulars remind of these again.

  • Do not hijack old forum threads by posting a new question as a reply to an old one
  • Do not post the same question multiple times
  • Do provide evidence of having done some work yourself if posting questions from school or work assignments
  • Do post in full-sentence English
  • Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

This last two are generally considered to also cover the practice of posting a series of fragmentary posts in the manner of a chat room or Twitter feed. As my own post demonstrates, you are not limited to 144 (or even 288) bytes of plain text, and posting sentences separately which could be part of a single post is irritating and inappropriate. Note also that you can edit posts up to 30 minutes after they have been submitted, so typos can be corrected after the fact as well (up to a point; we will forgive it if you simply didn't notice it until after that 30 minute window).

This forum is also unlike a chat room in that it can take hours or even days before someone gets around to reading and replying to …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Before proceeding, it should be mentioned that the header file "stdafx.h" is specific to the Windows Visual C++ compiler. Given that the professor has stated that the submitted code will be compiled using GCC under Linux, the inclusion of that header will be a showstopper for you - and one which is entirely unnecessary, as you don't use anything referenced in the header.

Now, to be fair to you, I need to note that the Visual Studio IDE will insert that into certain kinds of C++ projects automatically, on the assumption that the code is for Windows and only Windows. This is the sort of thing a novice cannot be expected to know, so it isn't your fault that you missed it.

Still, I recommend you remove it for now, and be on the lookout for it in the future.

I would recommend removing <cstdio> from the header and type implementation file as well, as it isn't actually used in either of those (yet). You probably will need it in the implementations of the functions pointed to by ItemPrinter() and PriorityPrinter(), but right now, it doesn't need to be there until you have something that actually uses the C Standard I/O library.

On a similarly pedantic and administrative note, I would recommend getting the unfilled information sections in the comments of the provided code before you go any further. It is a picayune and annoying thing, I know, but the sort of professors who give these kinds of pre-built …

Zack_9 commented: Thank you this helps alot! alot of good tips! +0
ryantroop commented: Good catch on system header. That would have been awkward :-/ +9
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Let's start by re-posting the pseudo-code from the Stack Overflow post (at least, I hope it was meant to be pseudo-code, as it isn't quite legal C) in a somewhat more readable fashion.

begin
    int a, b, pow;
    float c;

    input(a, b);

    if (b < 0)
        pow = -b;
    else
        pow = b;

    c = 1;
    while (pow != 0) {
         c = c * a;
        pow = pow - 1;
    }

    if (b < 0)
        c = 1 / c;

   Output(c);
End

Let me also post the datapath chart for reference purposes:

Now we can address your question. Let's start by pointing out that the number of data paths is equal to the number of branches in the path; so any time you have a conditional statement (if(),while(),for(), do..while(), orswitch()), you have an additional path. If a case analysis (an if() or a switch()) has more than one path - for example, an else clause, the multiple case clauses in a switch(), or the exit condition of any of the loops - then each of those needs to be counted. So, for this code, the first conditional is

    if (b < 0)
        pow = -b;
    else
        pow = b;

which has two paths, the if() and the else. Note that most C programmers would use the abs() function instead, and count this as one path, but as given, it is two paths.

The next conditional is a while(),

    while (pow != …
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

OK, let's start off by pointing you towards the Daniweb Forum Posting Rules before proceeding, as you just broke several of them.

  • Do ensure that all posts contain relevant content and substance and are not simply vehicles for external links
  • Do not post the same question multiple times
  • Do provide evidence of having done some work yourself if posting questions from school or work assignments
  • Do post in full-sentence English
  • Do not write in all uppercase or use "leet", "txt" or "chatroom" speak

This last two are generally considered to also cover the practice of posting a series of fragmentary posts in the manner of a chat room or Twitter feed. As my own post demonstrates, you are not limited to 144 (or even 288) bytes of plain text, and posting sentences separately which could be part of a single post is irritating and inappropriate. Note also that you can edit posts up to 30 minutes after they have been submitted, so typos can be corrected after the fact as well (up to a point; we will forgive it if you simply didn't notice it until after that 30 minute window).

The rule about posting multiple times also applies to simultaneously cross-posting a question to several message boards (such as Daniweb, Dev Shed, and Stack Overflow), though it is more a matter of timing - you should post in one at a time, giving the forum time to answer the question before cross-posting elsewhere …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

While I can't say much without more detail about the rest of your code, I am pretty sure that, as you seem to suspect, you have either missed or misunderstood part of the assignment. I may be wrong, but based on the description of the problem, it appears that the function signature should be closer to (but not quite; see further down for the full explanation):

void insertEdge(int u, int v, int w, Graph& g);

Where Graph is the second of the two struct types described in section 4 of the assignment:

An object of type Graph represents a weighted graph. It has four fields:

  1. the number of vertices in the graph,
  2. the number of edges in the graph,
  3. an array of Edge structures that holds the edges,
  4. the physical size of that array of edges.

Include a constructor Graph(nv) that yields a graph with nv vertices and no edges. The constructor must create the array of edges.

Note that the Graph type requires the Edge type to already be defined, as each Graph object is has an array of Edges as a component.

So before you do anything else, if you haven't done so already, you need to define the Edge and Graph structures. I assume you've covered structure types already, but the assignment does give a link to the previous lecture notes on struct types, as well as the expected naming and documentation conventions.

Note as well that the …

ddanbe commented: Nice! +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Please do not reanimate old threads, even if you are asking a question similar to the existing one. If you have a new question, start a new thread.

I recommend reading the forum Posting Rules, Terms of Service and Advice on Asking Questions before proceeding here. Specifically those pertaining to asking for help on things like employment tests, homework, and, as in this case, online coding challenges. This one in particular seems relevant:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

As a word of warning: I was readily able to find out where this problem is from with basic searches on Google and DuckDuckGo. If I can find that, then the people running that website can find this thread, too.

Oh, and the fact that the Google search also brought up at least one solution doesn't exactly reflect well on your ability to research a problem, either.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

OK... not sure if you read the rest of what I said to the OP or not, but whatever.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

@Kes166 Correct me if I am wrong, but I am pretty sure that in Standard C++, array declarations must use a compile-time constant for the array size. I know that the g++ compiler will allow C99 style dynamic arrays by default, but it isn't standard C++ (unless it was added since I last checked, which could well be the case).

In any case, I seem to recall that even in C, a dynamic array size has to be a constant known at the entry point of the stack frame, meaning that you can't use something from user input unless it is passed as a function parameter. I would need to check to see if I am right however.

This means that if the OP needs to size the arrays based on user input, they need to either:

  • Allocate an over-sized array and hope that it is enough - this terrible idea was a common practice in general in the past, and remains one of the largest sources of bugs and security holes (in the form of buffer overruns). I would avoid this if you have any choice about it.
  • Use explicit dynamic memory allocation using the new and delete keywords.

    bool* occupied = new bool[rooms];    // why would you use double for marking occupied rooms?
                                                             // also, note that 'occupied' is a pointer
    
    // then later...
    delete[] occupied;

This is a lot better, but does mean that you have to watch how you use …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

First off, please do not resurrect old threads this way; if you have a new question, start a new thread. It is quite horrifying to find that this thread has been restarted at least three times in the previous eight years, even before you did it, which is absolutely ludicrous.

Getting to the problem itself, we would need to see the actual error output from the compiler to have any idea of where the problem lies. I do see at least one problem (the line #include <math.h>, which is using the old-style C header instead of the modern <cmath> which Code::Blocks is expecting - the most widely used version of Turbo C++ predates the 1998 C++ standard by nearly ten years, so much of it was already out of date 20 years ago) but I don't think you would have had to post here to find the solution to that.

Which raises the question, how did you end up using something as ancient as... never mind, I know the answer already. It's because of all the Universities that have refused to change their standardized coursework for over 25 years and end up teaching things from the 1980s as if they were still relevant. It isn't your fault, but it is infuriating to see it come up again and again. Suffice it to say, you should take 99% of what you learned in those courses and throw them out the window as useless for modern programming.

(OK, that's hyperbole - …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

The OP might want to also consider that C and C# are not the same language, and that C++, Objective C, and Objective C++ are yet other different languages from those and each other, as well. Any answer we give will greatly depend on knowing what language the assignment is meant to be in. While it should be evident from the code in most cases, you haven't posted any, so we are left in the dark about it.

I am guessing that the language in question is actually C (which is hat the assignment description reads), not C# (as per the thread title and tags) or any of those others, but that is because I am assuming that you simply pasted the assignment into the post without changing it.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

@Jose_17: You might want to consider whether your professor really wants you to do that or not, in something that is clearly meant as a lesson on how to write assembly code. You might also want to consider whether they are going to be watching fora like this one to see if someone posts their assignment in order to get someone to do it (ProTip: they are).

I recommend reading the forum Posting Rules, Terms of Service and Asking Questions Advice before proceeding here. Specifically those pertaining to asking for help on homework. This one in particular seems relevant:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

rproffitt commented: OP didn't write this was school work. Why not learn how this is done IRL? +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

My first question is, how does this improve over the mail merge functionality that nearly every SMTP mail reader has had since the 1980s? Outlook has been able to do this out of the box since it came out - heck, Outlook Express could do it, for that matter, back when that was a thing.

Now, it is possible you do have a better mousetrap in mind, but if so, you have not explained how it is better. Conversely, if you are climbing this mountain because it is there, that is fine too, but the way you are speaking of it gives the impression that this is part of a larger project.

Having said that, allow me to address the question itself. I recommend forgetting about using ShellExecute(), and looking into the Office API to work with Outlook directly. You will probably want the Add-Ins API rather than the web-focused Graph REST API, though you will need to look over both to be certain.

Keep in mind that the current Office 365 version is a Software-as-a-Service package; the Office application executable is just a launcher for the cloud application, comparable to an Electron wrapper on a webapp, meaning that Outlook (and Word, Excel, and the rest) is no longer a stand-alone program at all. Older versions of Outlook worked rather differently, though the ordinary user wouldn't be able to tell the difference.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

And the reason you are using VB 6.0 and MS Access is?

I am not saying it is wrong to do so, but it is a bit unusual, which makes me think there's more information we'd need in order to help you. The reasons for using those - and some facts about the application domain and the purpose of the project - is perhaps the main thing we need to know right now, in fact.

I will say that I suspect you are going to find the goal a difficult one, as I don't know how well VB 6.0 works with Access 2010 (I am surprised they interop at all, really, as MS had dropped support for all pre-.NET versions of Visual BASIC in 2008) and just as importantly, I am not certain that the solution you are trying to implement is the best one.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I am assuming this a class assignment, or some sort of training exercise, since, as @rproffitt said, for any sort of work project the logical solution would be to compile the C code.

Now, both for ethical reasons and due to DaniWeb TOS, we cannot just give you the code. Even if this weren't the case, we'd need to know which development target and toolchain you are using, and what restrictions on the solution exist if any, as the obvious answer would involve using pseudo-instructions, which not all assemblers support, and not all professors permit. It might be useful if you can tell us if you need to manually hoist load and branch slots, as well (though since you said MIPS64, and I am pretty sure delay slots don't apply to any 64-bit versions of MIPS, it probably doesn't matter).

We can give you advice on how to write it, however. I would recommend starting by looking at the documentation on the instructions lw, beq, j, and sw, as well as the pseudo-instructions blt, and li. Once you have that, if you still have problems, try posting the code here (with the necessary information about the tools you are using) and we'll see what we can tell you.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Just to be clear for anyone reading this later, the example code in the original post is from the NASM online documentation.

I am afraid that it really wouldn't be of any help here. The %substr directive is for working with substrings of strings defined at assembly time, being for use in macro programming. It is mostly there as a convenience - the programmer doesn't need to manually define multiple string constants for the substrings, or manually manipulate them at run time, but can have the assembler figure out the details for them.

The practical upshot of it is that %substr can't be used with user input at all. Sorry.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Please don't resurrect long-dead threads like you just did. It is very unlikely that the people you are replying to are still on Daniweb after 8 to 9 years.

As for the answer to your question, we will need more information. What version of MASM (or any other compatible assembler) are you using, and do you have the Kip Irvine library and include file in question? What development environment are you using (you mentioned a memory window, and given the topic, I would guess Visual Studio, but that's not a given)?

Also, what data are you trying to pass to DumpMem, and how? The code for this port of the library to NASM for POSIX systems shows the following passing convention (which is the same as in the original Irvine library):

DumpMem:
;
; Writes a range of memory to standard output
; in hexadecimal.
; Receives: ESI = starting offset, ECX = number of units,
;           EBX = unit size (1=byte, 2=word, or 4=doubleword)
; Returns:  nothing

Could you post the code you have tried to run, please?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

OK... first off, if you don't mind me asking, why did you settle on VB 6.0 and MS Access? Is there a specific need for that particular (20 year old, no longer supported) version of Visual Basic, or any reason why you couldn't use either the built-in Access VBA (depending on the version of Access - more on that in a moment), or conversely, a version - any version - of Visual Basic NET?

I ask because the reasons may have some bearing on the answers we give, and the options at your disposal.

The next question is, what version of Access are you using, and on a related note, what version of Windows is this running on? I ask this mainly because both VB 6.0 and editions of Access older than, uhm, I am not sure off hand but I think it would be 2003, might not run correctly (or at all) on version of Windows more recent than Vista, at least not directly (though you could be using an emulator or virtualizer I suppose).

The last question is, is there existing data already in the Access database, and do you have it properly backed up? I ask this because, aside from the usual concerns of disk failures and power surges and so forth, Access (especially 97 and earlier) is notoriously unstable when you are doing a lot of changes, as is typical of testing during development. I recall the problems this can cause all too keenly, …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

In the future, please check the dates of a thread before replying.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

The listings are by database engine, not language.

Which SQL RDBMS are you using (SQL is a standard, not a specific DB engine), and which version? I am guessing MS SQL Server, but I would not want to assume.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

@rproffitt and @rubberman: I am assuming the OP is writing this for an assembly language course, in which case the C code is simply given as a guide for hand-coding the assembly program.

@Kunyepa: How is the code misbehaving? Can you post the errors you are getting?

It would help if you could tell us the platform (presumably a MIPS simulator such as SPIM or MARS, though I guess it could be an actual MIPS processor), and what constraints your instructor has given you (e.g., the dreaded "no pseudo-instructions", which can be a serious impediment if you need to use any labels for data addressing). Are you expected to match the algorithm exactly, or is it just a guide which you can discard as long as the result is correct?

On a related note, has you instructor mentioned either a) reversing the loop conditional (e.g., using a decrementing count from x to zero rather than counting up) or b) using a jump table to index a test? Also, has the option of pre-sorting the test (i.e., writing a sorting routine to get the grade values in order, which can simplify the test at the cost of greater overhead overall - it's the kind of thing that can be slower when the data set is small, but speeds things up with a large data set) been brought up? Just a few hints.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster
Schol-R-LEA I am goonna go there too and discuss this same issue.

OK, then. Just make sure you have read and understood the wiki pages I linked to previously before posting anything there. I am not kidding about the forumgoers being a bit prickly - a lot of would-be OS devs have posted something like this there in the past, and the regulars are not very kind towards newbies who don't take the wiki's advice to heart. While they are not nearly as vicious as they were, say, five years ago, they will give you a hard time if you post there without careful consideration about what you want to say, and which message board you want to post to.

Seriously, I would suggest you lurk there for at least a week, and search the forum archives for previous answers, before even saying hello. Otherwise, you'll be stepping into a lava pool, as rproffitt put it.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I agree with JOSheaIV that this seems somewhat hinky. However, if you are in fact sincere, you would find a better forum for this matter at the OS-Dev forum, which covers issues related to this in greater detail.

However, you do not - I repeat, DO NOT - want to post this sort of help request there, especially in the "OS Development" or "OS Design and Theory" fora (that's what the "Announcements, Test Requests, & Job openings" board is for), as the posters there do not suffer fools lightly. You want to read the OS Dev Wiki before posting anything there, especially the Introduction, How to Ask Questions, Beginner Mistakes, Required Knowledge, and Getting Started pages. In particular, the section on Teamwork is relevant here:

Teamwork
The number one beginner mistake seen in the Announcements forum. They usually come in one of two forms, although they have quite a bit of overlap:

Community Projects
Don't overestimate your chances of getting people interested in your project. Even the more successful projects usually consist of one, perhaps two people actually working on the code. And that is not due to a lack of need.

Brooks' Law states that the more people on a project, the longer it takes. The only way around this is to split the project into parts that you get people working on and only on that part. …

rproffitt commented: True, a post like that could be like dipping toe in lava pool. +7
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Actually, in India and Pakistan, it is even worse that that: last I heard (as recently as last summer), the national university systems continue to mandate the use of Turbo C++ 1.5 as the standard C/C++ compiler, and professors are forbidden to use anything else for introductory C++ courses (whether they can use other languages in introductory courses wasn't clear, but aparently the scholastic exams are all based on C++, and the tests haven't been changed significantly since around 1995). All efforts to change this have been furiously resisted for decades, apparently.

At least, that is my understanding of the situation, but the issue has been discussed here and elsewhere on numerous occasions, and the consensus is that the national exam system governors see change as a bad thing, and refuse to acknowledge that anything is wrong with the curriculum.

https://www.quora.com/Why-is-Turbo-C++-still-being-used-in-Indian-Schools-and-Colleges

http://stackoverflow.com/questions/1961828/why-not-to-use-turbo-c

https://www.quora.com/Why-should-we-not-use-Turbo-C++

http://www.roseindia.net/programming/tutorials/C++Tutorials.shtml

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

In the absence of further information, should we assume you spoke to the professor and all is right in the world, or did you still need help, and if the latter, what problems are you experiencing?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

DaniWeb receives about one thirtieth of the traffic we received three years ago and only getting worse.

Yes, but I gather that this has been true about programming fora across the board, for reasons completely unrelated to DaniWeb or its design (e.g., word has gotten out to college students that IT is not a way to get rich with minimal effort, and they have been dropping programing courses in droves, especially in the places where it has been absurdly oversold such as India, China and Russia). Even SO has lost most of its traffic, and most other programming sites (Gamasutra, DevShed) are nearly abandoned. That Daniweb has any traffic at all now is a success.

The irony is that, unlike some fields i.e., medicine, this is actually a good thing for IT. For decades there has been an excess of CSSE students in both universities and trade schools, most of whom have had little inclination to the field but were drawn by the smell of lucre falling from the skies. Worse, as CS enrollment rose, funding fell (or rather, grants were increasingly earmarked for specific projects or purchases rather than general course material), making the schools teach more and more students with fewer and fewer instructors and resources. It has left IT teaching a shambles, doubly so because most of the students didn't really want to be there and had no real desire to be in the field. The result is that the field is now flooded with …

dtpp commented: dont see what you wanted to tell us...... please explain +0
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

What Labdabeta said is correct, but a bit skimpy, so I'll give you a bit more detail.

For the first five to ten years of programmable electronic computers, programming was done in machine code, though even that can be a bit of an overstatement - several of the first generation computers had no I/O such as we would understand it today, so entering a program would require the opcodes to be entered by means of wiring up a patch panel (think of an old-time phone operator's switchboard and you have the idea). While this was quickly supplanted by punch-card and paper-tape readers, this still didn't change the process of writing a program much.

Initially, the machine codes were written down for entry in a purely numeric format - sometimes decimal, but more often either octal or hexadecimal - but very soon it was realized that this wasn't practical, so a notation was developed for writing the opcodes as word abbreviations. This was called various names but the one that ended up sticking was 'assembly' code, from the fact that the programmer would 'assembly' the program with it. It was used for keeping track of the code while writing it; however, at the time, it was still converted to the machine opcodes by hand, then entered to a punched deck or tape for reading into the machine. Because the computers of the time were based on very unreliable technologies - vaccuum tubes, mercury delay lines, and the like - running a …

StuXYZ commented: Great summary +9
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

A better place to start might be the OSDev wiki, especially the Introduction page (particularly the section 'What Is An Operating System?'), Beginner's Mistakes, and Required Knowledge. The textbook can come after you decide whether or not you really want to tackle such a major project; chances are, after you see just how big a task it really is, you won't. Operating system development is perhaps the hardest area of programming, a task even seasoned pros would hesitate to take on. The only things that come close are language and compiler design, DBMS engine design, and window manager design (which is a completely different thing from OS design).

On second thought, I suspect that the part you actually want to read is What Is A GUI?, since I am pretty sure that what you are looking at writing is a desktop manager, not an operating system. While it is possible to focus on the UX of an OS design early on, you still would need to have a working kernel and other more basic facilities first before even contemplating that.

I'd still recommend reading the other sections, as they will clear up some of the confusion you seem to have, and will probably save you a lot of headaches. I'd also recommend lurking on the OSDev forum afterwards, but you really don't want to post there until you have covered the basic material in the wiki …

Reverend Jim commented: Great answer. +13
ddanbe commented: Better answer than mine!Top! +15
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Hmmn, that is the most recent version, so you should be fine. My concern was mostly that you might have had an older compiler, and might have wanted to upgrade if it were.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

nathan.pavlovsky: I know that you have the explanation, but the question itself may indicate a possible problem. I say this because it used to be common for compiler packages to cross-include headers in order to support older code, but most newer compilers' libraries have eliminated most or even all of these cross-inclusions. Running into a cross-inclusion issue is uncommon (but not unheard of) in recent releases of most C/C++ compilers. Which compiler (and IDE, if any) are you using, and what is/are the version number(s)?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I think a more basic explanation may be called for...

Like most languages still in use, C++ is still evolving over time, and the official standards for the language is updated by the International Standards Organization (ISO) and the American National Standards Institute (ANSI) at irregular intervals as the development committees set the changes into the rules. The different versions of the language - which generally are backwards compatible with older code, but add new features and clarify the details of older rules - are given by the name of the agency that released it, the name of the language, and the year it was released. For example, ANSI C 89 was the first 'official' standard for C, released by ANSI in 1989. The current standard most C++ compilers support (at least partly) is ISO C++ 11; since ANSI accepts the ISO standards for most programming languages as the same as their own, the 'ISO' part is usually dropped, so it is called C++11. There is a newer update, C++14, but it is a minor update for the most part (mostly clarifications of problematic parts of C++11) and most C++ compiler developers haven't gotten to working on supporting it yet.

You'll also note that most C++ compilers are also C compilers, so you want to make sure that you are compiling for C++ for this class, not C.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

natanhailu: I realize that you are a newcomer here, but there are some pieces of netiquette you should be made aware of. First off, you should not post a new question in another poster's existing thread unless the question has some bearing on what is already being discussed. Doing that is called 'thread hijacking' and is considered rude, as it derails the thread from its original purpose. If you have a new question, please start a new thread.

Second, there are separate fora for different languages. The forum you have posted to is the one for the C++ programming language. If you have a question about Visual Basic .NET, you should post it in the appropriate forum on the message board.

Third, clarity is paramount when posting in any technical forum, mailing list or newsgroup. You need to be as specific as possible about the problem you are having and the help you are looking for.

I hope that these comments are taken in the spirit they are intended, and that they help you with future posts on Daniweb and elsewhere. I would recommend going over the forum rules and reading 'How to Ask Questions th Smart Way' by Eric S. Raymond for further advice.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Thnx for your replies....actually i am B.TECH in computer science.

I assume that you mean that you have actually graduated with said degree, rather than that you are currently a student. Unfortunately, that still tells us little about your programming ability, as quite a few people graduate with Bachelor's, Master's, or even Doctoral degrees who have no skill or knowledge of the field they allegedly are accomplished in, and sadly, it is possible to go through an entire career in high-paying positions without learning a thing as well.

As for your question regarding DLLs, as has already been said, we would need a lot more context to determine what, if any, relevance they have to your project. since you are working in Java, the most obvious answer would be 'none at all', but it all depends on factors we don't know.

Dynamic Link Libraries are a feature of Microsoft Windows which allow native code libraries to be shared in system memory by multiple processes running simultaneously; the same feature is called 'shared libraries' in Unix-like operating systems such as Linux or MacOS X, but in all cases, the support for them is specific to the particular operating system.

Now, one of the primary aspects of Java is that it does not run native on any operating system; Java programs compile to a bytecode that is either run directly in the virtual machine, or is further compiled to native code by a Just-In-Time compiler that is managed by the …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Part of the practical upshot of what vijayan121 is saying here is that you should always pass stream objects (or any other non-copyable objects) by explicit reference (that is, using the reference operator, &) rather than by a pointer reference or by value.

Actually, this is a gross oversimplification, but it is the easiest rule to follow until you have a better understanding of the actual mechanics involved (see the Abelson example at the end of the 'Real Life' section on that page for a clear explanation of why this sort of approach can be useful in a CS context).

On a related note, you will notice that the code example does not use the using namespace directive. This is an important issue, for a number of reasons, but the main one is namespace control. As a general rule the using namespace directive should be avoided in any but the simplest programs; the main purpose of namespaces is to prevent name collisions between different modules, and the using namespace directive subverts that goal. It is better as a rule to either explicitly scope cross-namespace references using the scoping operator, as vijayan121 does here, or to scope the individual elements you are using, like so:

using std::cout;

Explicit scoping is always preferred, but since it can get awkward, the element-specific using directive is acceptable, in most cases, as long as it isn't abused (which is something of a judgement call). This is especially true for …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

As an aside, the wording here in the original post caught my eye:

i have write and erased many code,right now whats left is this...

I was wonder, do you use any kind of source control? Even in small projects, revision control is very useful, if only because it gives a record of where you have been and what you have tried (well, within a certain level of granularity, depending on where you check in your changes and how often, but still).

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Do a search on the Travelling Salesman Problem, for details as to the algorithmic complexity of the problem and various solutions available for it, but keep in mind that your professor will - not might, but definitely will - do the same search as well. Copying the code from any of these sources will only get you the failing grade you deserve.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Yeah, I've had that problem myself; a lot of people can't get past the similarity in the names (which was Netscape's whole purpose in calling it that), and superficially, Java code and JavaScript code are vaguely similar, simply because they are both curly-brace languages with object systems that run in web browsers (more on that in a moment). The irony, of course, is that JavaScript is now vastly more important than Java for client-side web development, while Java has mostly moved to into application and server-side roles.

A big part of the association is that Java was touted heavily for the client-side when it first came out; applets were expected to be the killer app for Java. Unfortunately for Sun, applets proved to be a solution looking for a problem. While one of the advantages of applets is that they are a stand-alone program that can be embedded in a web page, with little or no reference to the HTML code, this also proved to be a weakness, as most of the things needed in websites proved to be tightly coupled scripting that works directly on the HTML code itself - precisely the niche JavaScript filled. For various historical reasons, most of the other uses which Java applets were well suited for ended up being filled through Flash and Shockwave instead, or (for Windows-specific uses) were co-opted by ActiveX components (which eventually died off as well, but by then the damage was done for applets). While there are a few …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Check the stickies before posting. As for which ones are best, you'd probably at least two different answers from every C++ programmer out there.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Desipte their names, Java and JavaScript are completely unrelated languages; in fact, when Netscape originally created JavaScript, they were going to call it LiveScript, but changed the name after Sun announced the release of Java in order to jump on the hype train. While some of the changes to JavaScript in versions 2.0 and later on were inspired by Java, the two of them are not connected in any way aside from the names.

Ahmed91za commented: thanks much appreciated +0