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

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.

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

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.

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.

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

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

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.

    int a, b, pow;
    float c;

    input(a, b);

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

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

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


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;
        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 != 0) {
         c = c * ...

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

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

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.

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

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

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

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.

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