Jamblaster 15 Newbie Poster

I think I have the answer to this:

First you get a self proclaimed expert who says it is absolutely wrong to ask for other people to write code for you (a la iamthewee) in this discussion here--> http://www.daniweb.com/software-development/cpp/threads/467572/question-a-car-class

Then you find this self proclaimed expert begging for other people to give them code here--> http://www.daniweb.com/software-development/cpp/threads/144681/way-to-do-this

Generally speaking, whenever you find a narcissist who thinks they know it all and claims to be an expert you also find a hypocrite with an amoral personality.

Personally my experience is that the less you know the more you are capable of learning.

With "Experts" like these on this site it isn't surprising to me that honest people with actual good intentions (more than just to propagate their own fantasies of grandiose and or superior intellect) who offer help on here are branded as unhelpful and verbally chastised by those same "Experts".

Just wanted to let everyone know on here that these so-called experts aren't always what they appear to be and anyone who would ask for code and then tell others who would do the same thing that they are bad or ignorant in some way isn't really an expert in anything at all except serving their own small self interests.

One final note is that this message about the experts on here (obviously) isn't aimed at any of the actually helpful people like ddanbe and ancient dragon (who I have seen many helpful comments by and found …

Jamblaster 15 Newbie Poster

Ok, I have solved the problem. Thanks to everyone who offered advice, but I had to solve it myself (and that is always the best way isn't it?). If you run into the problem I had where you're running Windows and Apache and PHP then you can solve the problem of PHP executing executables being blocked by the Interactive Services Detection pop up (and run in the background as session 0 or whatever) you can solve the issue by uninstalling Apache as a service and running it as an app under an administrator's account. I don't know what implications this has on security, but I can tell you that if you run it as an app under an admin you will be able to run executables from within PHP scripts. Once again thank you to everyone for your helpful hints, but I guess this problem is one that you can only solve by being there and putting in enough research.

One important note is that if you are running Apache and PHP under Xampp then you can uninstall Apache as a service by just unchecking the green checkmark next to Apache on the Xampp control panel. Thanks to everyone again.

cereal commented: thanks for sharing your solution +11
Jamblaster 15 Newbie Poster

Ok, here is what I see. I see that you have worked hard on developing this program,but there is something I don't understand. In your function--> int openFile(File1, File2, File3) I see that you test if 3 files were open after the function returns to main, but what I see in the function is you returning a BOOL (true) when the function is supposed to return an integer (isn't it?). Try this: each time you successfully open a file in the openFiles() you could add one to an accumulator if(success) or keep the accumulator at whatever it was at(declare it as 0 at the top somewhere) and then return that accumulator at the end of the function. To be direct about it, the variable open will never, ever be == 3 if the function returning value to that variable doesn't accumulate anything and just returns true. Maybe I'm missing something, but I think that might be a problem.

Jamblaster 15 Newbie Poster

If you have a working SMTP email server installed on your web-server then you can use a simple PHP function to send mail:

mail($to, $subject, $body, $headers);

Headers are optional, but if you want to use them you prepare the $headers variable like this:

$headers = "From: Example@Email.com \r\n";
$headers.= "CC: Exampl3@Email.com \r\n";

Each header needs to use both \r and \n to work correctly.

To prepare the body nicely you can prepare it like this before sending it:

$body = wordwrap($body, 70);

You can collect any or all of these variables through an HTTP interface so you could send an email anywhere with any subject, body, headers,...

It would use the configured SMTP server for your web-server and it would send it through port 25.

jalpesh_007 commented: thanks a lot... +4
Jamblaster 15 Newbie Poster

I can tell that you really are trying to learn here and if you want to learn read and think about what the Dragon above said about p not being an integer.

Below here you can find an altered version of your last post of code within a working for loop which takes in input and provides output. It is (obviously) just a piece of test code and it is intended for you to use to see a possible way that you could go about solving this particular problem. Check it out and try to understand why it works:

#include "stdafx.h"
#include <iostream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{

    int products;
    int p, y, x, z, a, b;
    int items[100]; // don't know how big to go
    int quant[100]; // don't know how big to go
    float price[100]; // don't know how big to go
    float subtotal = 0;
    int peices = 0;
    float net[100]; // don't know how big to go


    //some code here
    cout<<"How Many products do you want to purchase ? :";
    cin>>products;
    for(p=0,y=16,x=32,z=52,a=61,b=68;p<products;y++,p++) {

        cout << endl << endl << "Item Number Please: ";
        cin>>items[p];
        cout << endl << endl << "Quantity Please: ";
        cin>>quant[p];
        cout << endl << endl << "Price of Item Please: ";
        cin>>price[p];
        net[p]=price[p]*quant[p];
        cout << endl << endl << "Net price of " << quant[p] << " of item number " << items[p] << " is: " << net[p];
        cout << endl << endl << "The subtotal …
Jamblaster 15 Newbie Poster

Something like this maybe:

// right where you collect option the first time put this

cin >> option;
option = tolower(option);
while(option != 'c'){



} // right above return 0; you put this to close the while loop

I don't know if that is exactly what you're looking for, but it if you place it in the right place it will force the system to iterate through more than one of whatever you are processing. Like the comment above, I can't understand any instructor would every tell a student of C++ to not use functions or struct or objects becasue that is where the power of C++ really lies (at least in my opinion). Anyway, hope this helps.

Jamblaster 15 Newbie Poster

Your spaces are disapperaring because you aren't using an input method that grabs a whole line and stores it (like getline(cin, <string>), for instance). Maybe you could also just use the string class instead of C-strings because they make so much more sense and are so much more useful in actual programming--unless of course using a C-string is what you have to do, in which case you just need to adjust your input methods and possibly append a " " to the end of each C-string except for the last one. Just a thought.

And in response to the above poster, I totally agree and think you might want to try Visual Studio because it is a great (and free to use for students) all-in-one IDE for multiple languages.

Jamblaster 15 Newbie Poster

Read the exact specifications of the assignment--what has to be done (methods) what has to be tracked/stored (instance variables) and create the classes with the variables and the methods to perform the required processing. It looks to me that you are on the right track and all you really need is to carefully read and think about what the problem is asking. Maybe get out of a piece of paper and plan the design out very carefully and then code that design so as not to miss anything. The objects and methods required are right there in the requirements you listed and if you carefully write them out then you will be sure to get everything.

Jamblaster 15 Newbie Poster

And here's a quick alteration I did to show how you could parse out spaces. You could use this same kind of technique to parse out anything you don't want as input:

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Dim num_len As Integer = 0 ' set by length of whole numbers
        Dim per_len As Integer = 0 ' set by length of decimal numbers

        Dim str_input As String = TextBox1.Text ' holds user input provided from MaskedInputBox
        Dim _Count As Integer = str_input.Length ' total provided input string length

        Dim str_number(_Count) As String  ' maybe the length is all whole numbers?
        Dim str_Decimal As String ' Same as above
        Dim str_Percent(_Count) As String ' maybe the length is all decimal numbers? Holds numbers after "." is found

        For X As Integer = 0 To _Count - 1  ' Parse the whole numbers out now


            If (str_input(X) <> "." And str_input(X) <> " ") Then  ' Parse the whole numbers and remove spaces then the decimal point

                str_number(X) = str_input(X)

            ElseIf (str_input(X) = ".") Then

                num_len = X ' whole numbers equals how many iterations before we found "."
                GoTo PARSE_POINT
            End If
            If (0 = 1) Then
PARSE_POINT:
                str_Decimal = str_input(X) ' 'parse the decimal point out now
                Dim dec_place As Integer = X ' the decimal point is found where the 'X' For stopped iterating to come here

                For Y As Integer = 0 To (_Count - (X + 1)) ' …
Jamblaster 15 Newbie Poster

Here is the solution to your problem. First, to solve the conundrum presented by DDanbe, you need to use a MaskedTextbox and set a custom mask using as many numbers and you want on the left then a decimal point and then as many as you want on the right. If you don't know how to do this then look it up. Next you have to parse the input from string to strings to numbers to number like so:

Notably, the code is ugly because I wrote it fast for an example, but it works (and that's what matters). Check it out and it will show you how to parse input to validate that you have a double and then use that double in some way (I used a msgbox to display it). Anyway, hope this helps.

  Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Dim num_len As Integer = 0 ' set by length of whole numbers
        Dim per_len As Integer = 0 ' set by length of decimal numbers

        Dim A As Integer = 0 ' place holder

        Dim str_input As String = TextBox1.Text
        Dim _Count As Integer = str_input.Length

        Dim str_number(_Count) As String  ' I don't know big of a number you want to go up to
        Dim str_Decimal As String ' Same as above
        Dim str_Percent(_Count) As String ' Use this to hold numbers after the "."

        For X As Integer = 0 To _Count - 1  ' Parse the whole numbers …