I think you've misunderstood how message boards work. Just posting a link tells us nothing about what problems you are having, and no one - no one - here is going to be daft enough to follow a blind link like that, anyway.

I should add that it is also a banning offense to do this, as it looks an awful lot like attempted link spam.

Could you start by telling us what help you need?

@JamesCherrill : The standard Python implementation doesn't do TCO by default - Guido had doctrinal problems with it because he felt it makes stack traces effectively impossible - but there are several implementations of decorators which will force tail calls to be optimized in various ways. The most widely used on appears to the one maintained by ActiveState (though it isn't specific to their implementation of Python). This simple one seems easy to find as well. This blog post discusses the development of such a decorator in detail.

JamesCherrill commented: Thanks for clarifying that. +15

And what makes you think a single answer is going to be possible, or that it would even be relevant in a development forum? Is your intention to try to clone it or something?

This rather old post of mine discusses the use of recursion in general terms; the discussion following it in that thread might prove of value as well. While it is presented vis a vis C++, it applies to Python just as well, IMAO.

The question is very muddled, as it seems to be mixing unrelated topics - the technologies for developing a coupon system (whatever you mean by that, as it isn't entirely clear if you are talking about transferrable discounts or something else; also, note the spelling of 'coupon'), the legal requirements for a coupon system, and the tax code in your local jurisdiction, just to name a few.

As rproffit stated, the best person to discuss the legalities of such a system would be legal counsel (presumably one specializing in contract law as it applies to transferrable discount coupons), not a technical forum. Similarly, the issues of tax codes would be better referred to a CPA, or more likely, a lawyer specializing in tax law (which is a very different topic from contract law vis a vis discounting, which means you'd need to talk to two lawyers at minimum).

None of which relates to the technical side of how to compute the tax applied to these discounts, though you won't be able to write your code for that without speaking to those experts first.

The statements and questions regarding the technology used are, to be blunt, baffling to me. They are so general and uninformative that there simply isn't any substance to what you've said which I can comment on. Could you please explain your intended design in greater detail (without revealing any proprietary information, of course)?

rproffitt commented: To me the tax angles are not muddled as we know to get with our tax attorney. The rest? Muddy. Coupon sites are free here. +15

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?

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 standard ...

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

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.

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.

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, so we'd ...

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 patterns or higher-order operations, however, as the usual ...

rproffitt commented: Bizarre implementations? How else to avoid being called out for plagiarism but to make the most bizarre solution? +15

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

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
         { do something here }

while counting down is

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

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

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

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.

You say,

I have been programming C# for some time,


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

@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 ...

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

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 assignment specifies ...

ddanbe commented: Nice! +15

@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 the allocated array - ...

@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

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.

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.

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, and I ...

@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.

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:

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. Good luck.

There are some things you need for standing a chance ...

rproffitt commented: True, a post like that could be like dipping toe in lava pool. +7

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.





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

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 (and at least one textbook) first, as they tend to be harsh on newbies ...

Reverend Jim commented: Great answer. +13
ddanbe commented: Better answer than mine!Top! +15

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.

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.

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