Eagletalon 34 Junior Poster in Training

To re-itterate: TRY FIRST!, dont give us your assignment and expect coding back... this is not a free software house, people get paid to do that...

so untill you can give us an example of your coding or actual problems that you are struggling with in it we WONT effectively help you

Eagletalon 34 Junior Poster in Training

values into a 2 dimentional array... output the arrays value by value, array by array

Eagletalon 34 Junior Poster in Training

Mandrew I think we are talking past each other...

What I am saying:

void class::a(){

    int MyInt = 5;

    b(MyInt);

    //MyInt = 6
}

void class::b(int* MyIntPointer){

    MyIntPointer++;
}

What you are saying:

void class::a(){

    int* MyInt = 5;

    b(MyInt);

    //MyInt = 5
}

void class::b(int MyIntPointer){

    MyIntPointer++;
}

See http://www.cprogramming.com/tutorial/lesson6.html

Eagletalon 34 Junior Poster in Training

Ok... Basics of Daniweb... TRY FIRST!, dont give us your assignment and expect coding back... this is not a free software house, people get paid to do that...

so untill you can give us an example of your coding or actual problems that you are struggling with in it, the best we can give you is:

Accept the month. - (input from user)
Accept the name of each staff. (Assume that there are only 5 marketing staffs) - (input from user)
Accept the number of student enrolled weekly for each staff. - (input from user)
Calculate the weekly sales for each staff. (Assume the fees for each student is RM 3000) - (calculation based on the input)
Display the monthly sales in a table. (see Figure 1) - (calculation based on input and special output)
Display the name and sales for the staff that is having highest sales. - (itterated comparison and display)
Display the name and sales for the staff that is having the lowest sales. - (itterated comparison and display)
Display the total sales of the month. - (calculation and display)

Also how the hell are we supposed to see Figure 1?

Eagletalon 34 Junior Poster in Training

cant think of an allready existing function... but if you have multiple arrays, use a bubble sort and apply the swop you are doing to both arrays instead of just one?

Eagletalon 34 Junior Poster in Training

When you pass by value, you "create" a second instance of the variable, local only to the function receiving it...

When you pass by pointer/reference you can see it as passing a big neon arrow pointing to the original variable...

thus you can imagine, as no additional memory is allocated or the value is not duplicated, it is much more efficient to pass a pointer/reference rather than by value, however this would mean that the function called would be able to change the value of the variable and have that change reflected back to the original...

To avoid this you could create a new variable in the function containing the value of the pointer passed, but then you are doing exactly the same as passing by value

alternatively... passing

"const int* MyInt"

would pass a pointer and make it constant (not changable)

Eagletalon 34 Junior Poster in Training

Start at the data, research what you have available and what you need and how to get that in your application...

Then you create an application which pulls in the data (saved externally as specified) and is able to display it, and also is able to enter new data, that would get you more than half way there, now you just need to follow the specs one by one...

Eagletalon 34 Junior Poster in Training

"add 1/3 to itself a large number of times and to compare the result to multiplying 1/3 by the number of times 1/3 was added to itself" & "Your program will do these additions 109 (1 billion) times." (perhaps they meant to say 10 x 9?)

so what I understand is this:

double Start = (1/3);
double Addition = (1/3);

double Multiplication = Start * (10 * 9);

for (long i = 0; i < (10 * 9); i++){

    Start = Start + Addition;
}

//compare Start to Multiplication
Eagletalon 34 Junior Poster in Training

cool man... give it a try, see how it goes, and if you manage just remember to mark the thread as solved

Eagletalon 34 Junior Poster in Training

OK OK OK, here is an example of what Suzie said you need to do, you do it yourself...

cout << "In which year where you born? (Example: 1995) ";
cin >> bjaar;
while <check if bjaar is not an integer>{

    cout << "Your entry was not a number, please correct it";
    cin >> bjaar;
}

now what you really need to do is drop the attitude, accept the input of people who YOU acknowledge know more than you (else you would not post in this forum) and start working to better yourself rather than attempt to convince others your then best

No one knows everything and most of what we do have some kind of flaw, but learning and developping our skills is what we call "GROWING UP"

you are considered a troll when you steal time of those who do not have it and are actually out of decency attempting to assist those who need it...

Eagletalon 34 Junior Poster in Training

uhm... WaltP, point 4 on your list is not "main" but "menu"... and I believe it can be void...

and the semicolon in point 3 is an end while the rest should just be spaced into a new line as an variable of the struct (I hope I said it right)

Ron Walt is correct on his points though he seems very irritated and quick to show out problems, thats the general coder way, try making your code easier to read and please dont be afraid of open lines and indentation... eg:

struct BuyerInfo
{
    int id;
    string fn;
    string mn;
    string ln;
    string ad;
};

BuyerInfo info;

and now, see BuyerInfo as a "datatype"... info as a variable of that type...

how would you create an array of 100 integers? apply the same

Eagletalon 34 Junior Poster in Training
SELECT DATEADD(DAY, 32143, CONVERT(DATE, '1899/12/31', 111)) -- RESULT = 1988-01-02
Eagletalon 34 Junior Poster in Training

I think he got confused between the Get method vs Set method...

also that specific error arises because you are trying to send to the function a variable in the main function but that variable is not declared or created in the main.cpp

Walt your posts can stand on their own but for a complete noob he wont understand a word, I know you are getting frustrated and trying to get the people to brush up on the basics, but I dont believe they will know where to brush up on if you dont give a reference,

that said, giving them code that explains everything also isnt the way to do it

WaltP commented: Yuo need to keep your *assumptions* about peoples mental states out of your posts. You on the edge of a Rules Infraction. -3
Eagletalon 34 Junior Poster in Training

I agree... its a decent way to check the outcome of your functions... alternatively you can use a try catch... but it comes down to the same

Eagletalon 34 Junior Poster in Training

Well I guess you could write an entire other program for the editing (which you can open from your main game with a call)

as for the file I think the best bet would be to save to a text file or some kind of encoding thereof... save the co-ordinates of everything and the links between them...

I take it your app will start with some kind of menu? start, load, options, exit etc...

if that is the case also save the name of the text file with an easy-to-read alias in another file (custom levels) or whatever and then access the specified file when requested...

You can then also create the levels you created in the same way and save in a different location or whatever...

In all truth its completely your porogative Im just giving my opinions of how I would do it... you can test alternatives for efficiency and ease of use...

Eagletalon 34 Junior Poster in Training

Well what compiler and libraries are available to you? what are you using too create a UI? OpenGL? DirectX? Qt?

Are you Using Visual C++? Dev C++? a little info goes a long way :)

Eagletalon 34 Junior Poster in Training

Hi everyone... I have found the cause...

In my constructer of the structs I called a function "disableMetaObject" which did not allow any of the Qt signals to be sent... and then my QAxObject wanted to load a void QVariant into a QString

so in short... dont call "disableMetaObject" when working with signals and catching QAxBase::exception signals...

Eagletalon 34 Junior Poster in Training

well I dont know much of this kind of coding... but I guess the best trick would be to first get the positions of each node? have that saved and be able to calculate the distance between each node?

then you can start with the current node... the node you want to go to... and compare the combinations of lengths applicable until you get the shortest one...

but without more info I wont be able to say...

Eagletalon 34 Junior Poster in Training

Hi there everyone...

Allright my setting is this:

I have written an C++ application that receives input from a user app, converts it to XML, and then posts it to our ERP (Syspro) through e.net COM objects using ActiveQt and in specific QAxObject...

The problem is this:

QAxObject inherits from QAxbase, which has the following signal according to its documentation:

void QAxBase::exception ( int code, const QString & source, const QString & desc, const QString & help ) [signal]

This signal is emitted when the COM object throws an exception while called using the OLE automation interface IDispatch. code, source, desc and help provide information about the exception as provided by the COM server and can be used to provide useful feedback to the end user. help includes the help file, and the help context ID in brackets, e.g. "filename [id]".

Very nice and all... now I have a few structs, each accessing a different COM Object and having different commands, but when I generate an exception (deliberately at present) in attempt to cause that signal to be emitted I immediately get the app crash and message "Access Violation Reading Location"

Here follow the specified coding blocks that should be accessed:

Header file:

Structs:

typedef struct Transaction_Struct{

    Transaction_Struct(XmlParserCLS* XmlCreatorMaster, LogWriter * LogsWriterMaster);                   //Constructor
    ~Transaction_Struct();

    XmlParserCLS* XmlCreator;                                           //Pointer to the XMLParserCLS

    LogWriter * LogsWriter;

    QAxObject* Transaction;                                             //QAxObject Pointer to the COM Object

    QDomDocument post           (QMap<QString, QString>& VariableMap);   //Transaction Post call and handling
    QDomDocument build          (QMap<QString, QString>& VariableMap);   //Transaction Build call …
Eagletalon 34 Junior Poster in Training

Managed it with timers... thnx in any case :)

Eagletalon 34 Junior Poster in Training

I believe I have traced the problem to a "Sleep(500)" call in the waiting between status check to the database... is there any alternative or way around this I can implement?

Eagletalon 34 Junior Poster in Training

Hey Everybody,

Allright my setting is like this:

I created a derived MVC program using C++ and QT on Visual Studio 2008, that sends multiple instructions to our ERP system through an external program...

On each command posted this way the user application needs to wait for a return string and react accordingly, this all happens in SQL with a continuos... query that takes place every 500 miliseconds with a timeout after x tries

Because of the large number of automation and lack of "communication" with the user I have included a "QProgressBar" in a dialog which gets updated as the functionality flows

The problem:

During these database queries while the application is waiting for a response my Progressbar animation is extremely laggy... the end aim is to convert to IPC and I believe this will solve it... but users have a tendency to want everything perfect (as you would all know)

Is there a way to either disable the animation in Win7 or a way to run the animation "outside the application scope" so it wont be influenced by the application database queries

Low priority but I cant really find references to this on google that are helpful

any specific coding required I will gladly provide but as you can imagine I wont be able to display the entire program...

Eagletalon 34 Junior Poster in Training

Hey Everyone,

I have run into a bit of a problem with regards to application startup...

I have written a C++ application with QT libraries that uses active QT to communicate with our ERP system in our business, the requirements are that any application we use needs to communicate its variables into this application by means of an argument list that uses unique splitters, and the application then checks the command (seperate argument) and handles the variables and inserts into XML to communicate them to the ERP

my issue is this, with larger argument lists (larger applications and more intricate functionality) the application take much longer to start up, functionality from the very first coding line to the finish is quick, as quick as I can possibly get it... but the startup is way too slow...

Is there anything I can do to speed up the startup? can this be caused by the large arguments? or could it be something else, I thought of dll loading as a possibility though I have tested running the application over a network and on the same machine (because to my knowledge dll loading takes even longer over a network) but I found exactly the same result

Thanking everyone in advance for the assistance

Eagletalon 34 Junior Poster in Training

^ now thats mean

Eagletalon 34 Junior Poster in Training

Hi amber... No-one is going to do your homework for you... show us you tried and we will assist where you get stuck... post some code or give errors or problems dont ask us to do everything

Eagletalon 34 Junior Poster in Training

Allright in visual studio, at the top you will see a dropdown box with the text "debug"... change that to "release"... then build the application...

now in the folder you saved the project there will appear a "release" folder, in this folder will be the files you want, this can be run outside your application as an .exe file

Eagletalon 34 Junior Poster in Training

freopen("Document.in" ,"r",stdin);
freopen("b","w",stdout);

is not C++... read the links that zero sent you...

Here is what zero tried to show you:

 ifstream myfile ("example.txt");
 if (myfile.is_open())
 {
    while ( myfile.good() )
    {
      getline (myfile,line);
      cout << line << endl;
    }
    myfile.close();
 }

 else cout << "Unable to open file";
Eagletalon 34 Junior Poster in Training

CASE (ISNULL([QtyOnHand],0)) WHEN < 0 THEN 0 ELSE ISNULL([QtyOnHand],0) END

Eagletalon 34 Junior Poster in Training

Perhaps your excel is not set to display the header & footer even though they are there?

Eagletalon 34 Junior Poster in Training

What exactly is the error you get? I have a feeling that would probably be because of an include that you are missing...

try: "#include <list>"

Eagletalon 34 Junior Poster in Training

Well in that case I am bloody impressed... well done :)

just ensure (with debug output) that your info is saved in the arrays correctly...

then follow thines' advice in his last post to create the list... and set it to the datasource...

Eagletalon 34 Junior Poster in Training

wth is the newton raphson method? did you try at all? take it all step by step and try to develop something rather than just asking others to do everything for you... if your stuck with a error or genuine programming problem (after TRYING) we will be happy to help

Eagletalon 34 Junior Poster in Training

Devfeel... Uhm, I dont want to sound rude but how can that be such a big problem?

converting and datatype shuffeling and loading into lists is something that should be rather simple if you managed the program you mentioned above?

thines01's advice is solid and will give you exactly what you need...

Eagletalon 34 Junior Poster in Training

alright do you know where the error takes place?

Maby narrow it does to a function?

Everything looks pretty well done allthough it feels slightly unneccessary here and there :?

Regardless, you deserve some credit for at least trying...

now, first thing... as a programmer, a sad truth about life is that you are going to spend a LOT of time searching for and resolving errors, a quick tip to assist, enter debug comments... what I mean is while testing enter an output message at the start and end of each major functionality with the possibility of crashing, even at the start and end of every method if you want to

these you can later remove (even add in an if statement which references a singal variable that sets your application to debug mode)

Im sorry but I really dont have the time to compile your code and alter and search and try to replicate the error... find it, show it, and lets see what we can do

Eagletalon 34 Junior Poster in Training

As Zeroliken said rand() is your best bet...

I assume you are being tested on the random function because that is really all that makes sense to me...

If you were supposed to work with input that was another situation... either way...

"rand() % 10 + 1" gives you a value between 1 and 10...

the reason for the "+ 1" is that rand() starts at 0... now using what zeroliken said above... look if you can complete the function in your for (I would use a while btw)

Eagletalon 34 Junior Poster in Training

Haha I guess I'd have to get around to this some or other time,

Hi everyone, My name is Jaco, and I am addicted to oxygen... its sad I know, tried to shake it many times but no luck :(

Lol ok seriously now, Ive been on this forumn for quite some time, I know occasionally I come across as a little harsh, but one has to learn by yourself as well some times, regardless I love this forumn, true geniousses ready to help us little guys and I try to help those under me as well

Im from South-Africa and I just want ot point out that we are not as technologically deprived as some would think ;)

well I guess thats all for now, love you guys, and ya... rock on :P

Eagletalon 34 Junior Poster in Training

For those interested I found a complete work around for my problem... I found that the library I was attempting to import was just a way to access the methods of the COM objects installed with the ERP... and that using the QAxBase class native to QT I would be able to access these COM objects without the library alltogether...

Found everything I needed in the OLE/COM viewer of windows 7 and http://qt-project.org/doc/qt-4.8/qaxbase.html

Thankyou for all the assistance everyone :)

thines01 commented: Persistence! +0
Eagletalon 34 Junior Poster in Training

Solved?

Eagletalon 34 Junior Poster in Training

Create a table with "id", "firstname", "middlename", "lastname", "address"

And select them into 1 field... closest I think you are going to get to what you seek...

Alternatively you can try different select statements or tricks to display in different ways... but I dont believe the nested tables are gonne fly

Eagletalon 34 Junior Poster in Training

Alright firstly, this forumn the people are not going to do something for you if you aren't prepared to do something yourself... I will however try to help you in getting started...

First place... find what is expected of your program... is there any user input? or is it all automatic? (HINT: "Ada has a .56 probability of winning any given point.")

how do you know the program has completed its purpose? (HINT: "the first player to reach 11 points wins")

Now tell me what you understand under the above statements... attempt to write a bit of code... and I'll help you further

Eagletalon 34 Junior Poster in Training

Well what are your current results? how do they differ from what you want to have? and why do you have additional "{" tags?

Perhaps you are looking for a line break at the end of each "cout" call? if thats the case use "<< endl;"

Eagletalon 34 Junior Poster in Training

Hahaha then I guess my work here is done ;)

just remember to mark the thread as solved... and good luck further :D

Eagletalon 34 Junior Poster in Training

Haha bloody well done... sorry I dont normally log in from home so I didnt get your updates...

If you think this is a stable version then I am highly impressed that you made it work by yourself... its a quality you need to develop, because I believe more than 90% of programming is solving problems (hence the forum was born)

I have 1 other suggestion for you though... if you believe your application is solid, have someone test it with the intention of "breaking" it... errors are absolutely unwanted in any application, warnings and confirmation requests is a good thing though, keep that in mind...

Eagletalon 34 Junior Poster in Training

another basic check you can perform to block to much working is to see if the input is 1... IIRC square root of 1 = 1 so no need to calculate

Eagletalon 34 Junior Poster in Training

ok first thing... in the case of an user inputting a negative value... what happens?

in the case of an user entering letters... what happens?

unfortunately in software development you HAVE to handle the possibility that your user is an idiot... (no offense intended)

try doing something like a while loop around your initial input that breaks out when the input in valid

Eagletalon 34 Junior Poster in Training

yeah the structure you can work on yourself... depends on what you want it to look like...

remember that as long as it makes sense you can put it into more than 1 line, you can change around, what ever you want... kind of the programmers right ;)

Eagletalon 34 Junior Poster in Training

that looks much better... And I agree with zeroliken... ok how about the following:

cout << "Starting calculation" << endl << endl;

while (fabs(value2-value1) > 0.0001)// for float absolute values

           { 

             cout << "Starting loop" << endl;

             cout << "Starting value: " << value1;

             value1 = value2;

             cout << "Overwritten to: " << value1;

             value2 = (value1 + value/value1)/2;

	     cout << value2 << endl;

}

Build further on this... try to always make your output descriptive and complete, then everyone can know what is going on

Also remember to make it easy to read... add in endl commands and spaces... get everything to display easy to read... just makes it easier in the future

Eagletalon 34 Junior Poster in Training

Please try to enter your code in the correct code tags... (ends with "[/code]")

So what stops you from just using "cout << current value" in the correct spot?

is this your own code? because I mean there is LOADS of cout and user communication, writing all that surely you understand giving output and how and where to do it?

Eagletalon 34 Junior Poster in Training

I dont recognize the datatype "CToolBar"... is this libraries added to C++?

Eagletalon 34 Junior Poster in Training

Replaces the variables Y and N by a variable 'Answer' of type char which also receives user input (Y or N), and on condition of while loop you can see if it is equal to Y. So if it is equal to Y, the cycle repeats. For maximum effectiveness could you put the functions

cin >> Answer;

into another cycle to repeat while the user did not enter Y or N. Instead of always repeating unnecessarily

cout << "Please enter the third program score (0-100):";
cin >> score;

you could also write this only once within a cycle that is repeated as often as thou wilt, keeping the value received from the keyboard in a vector of variables; makes you much to code view.
I hope this helps.

Here Al41007 gave the code of

cin >> Answer;

But you never declared "Answer" as a specific datatype... declare it before that line and it should take away the error