Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Almost all games and other major programs consists of many many files. What you learn in school only scratches the surface of what occurs in real life programs. Example: Notepad.exe probably consists of at least 50 *.c and *.h files. Every program you use in MS-Windows and *nix consist of a lot of files. Some programs consist of over a million lines of code -- can you imagine all that in a sincle file??

you will eventually write programs that consist of multiple files. That is done to keep things simple and organized into logical units.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Lets say you have two files A.cpp and B.cpp, each of them use the functions that are in functions.h. If you put the code directly in fuctions.h the linker will spit out duplicate function error messages for all the functions in functions.h. That's the main reason to put the functions in functions.cpp and the prototypes in functions.h. Can you immage the errors the compiler will spit out if you have 100 *.cpp files in the same program and each of them include functions.h???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Delete both lines 10 and 11. Line 11 will never be executed because of the k < k condition in likne 10.

Here is a good article about loop unrolling.

One of the optomizations you would make is to calculate i*j*idaonly once within a loop, save the result in another variable, then use that variable everywhere else i*j*ida appears in the loop.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe something like this:

void mystrcat(char* dest, const char* source)
{
   while(*dest)
      dest++;
   while(*source)
      *dest++ = source++;
   *dest = 0;
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We are not going to do your homework for you because that will teach you nothing. Give it a try, post the code you have written, then ask specific questions about what you don't understand.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

functions.lib

Don't do that! name it functions.c or functions.cpp. functions.lib should be the name of the library, not the name of the source file.

In Code::Blocks start a new library project and put all the functions you want in it. When CB compiles it CB will generate the functions.lib file for you.

To add your library to a project, go to menu Settings --> Compiler, then click the Linker Settings tab.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I like Visual Studio 2014, but it has a rather long and sometimes difficult learning curve. IMO the next best thing is Code::Blocks with MinGW compiler -- it's portable between *nix and MS-Windows where VS isn't.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What verson of Borland compiler are you using? Many of the old 16-bit Borland compilers were created before the c++ standards and require *.h file extension

// cin with strings
#include <iostream.h>
#include <string.h>
#include <conio.h>
//using namespace std;
int main ()
{
string mystr;
cout << "What's your name? ";
getline (cin, mystr);
cout << "Hello " << mystr << ".\n";
cout << "What is your favorite team? ";
getline (cin, mystr);
cout << "I like " << mystr << " too!\n";
getch();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Header files only contain function prototypes, not the functions themselves. You need to put the functions in a library. To use them just link the program with the library (*.a, *.so or *.lib) just as you would with all other standard compiler libraries.

how to create a library depends on the compiler you are using, there is no standard way to do it. Generally, put the functions in one or more *.c or *.cpp files, compile them (but do not link) to object module (either *.o or *.obj) then have your compiler add them to the library. If you are working with *nix, it has an ar pogram that can put the object modules into a library.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the file one word at a time, saving the words in another file except replace the 5th word (or whatever number it is) with the new word. You need two files, an input file and an output file.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The Ultimate version is only a trial version of the full program and you will be exprected to pay lots of money to continue using it. Donload the free Visual Studio 2013 Express I think you can get it on DVD if you have a really sloooow internet speed, such as dial up modem.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After changing my password I clicked the Edit Curriculum Vitae link and got the error "Oops! We don't know who you are ...". I clicked the back button and it returned me to my profile page. Apparently either one of two things happened: (1) after changing my password I was logged out but my profile page didn't know it, or (2) There is some sort of error in the Edit Curriculum link which thought I was logged out. After logging back in with the new password everything worked as expected. The only reason I even clicked the Curriculum link was to find out what it was for.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here's a thread on the same topic. You can open a printer port by opening "lpt1:", but that assumes the printer is attached to the LPT1 port on the computer. Most modern computers today don't have such a port, printers are attached either by USB or wifi. In that case you have to go through the printer driver, which can get complicated.

The easiest way to print simple text is to just save it to a file then call system() to send it to the printer, letting the operating system handle all the complicated stuff.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There probably isn't anything you can do about it, you are attempting to run a program compiled with a 30-year-old compiler for MS-DOS 6.x and Win95 in a modern operating system. DOSBox tries it's best to be compatible, but is not the same as the original MS-DOS. If you can, find a copy of MS-DOS or Win95 and run your program there to see if the flicker still occurs.

My guess is that the program erases the entire screen then repaints it. You might try erasing and repainting only the part of the screen that needs it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are several old MS-DOS games I would like to see ported, regardless of price. Eye of the Beholder is just one of them. That was a very fun game.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also, inlin is optional which means the compiler can choose to ignore it if the compiler wants to.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If I remove the myTicketFineCalculator then I get an error that getFine() isn't declared.

I didn't ask you to remove myTicketFineCalulator from that line. Just change the number of parameters.

totalFine = myTicketFineCalculator.getFine(totalFine); //This is where i am having issues calling the function

That is from your original post -- have you changed it? Maybe you should repost the code snippet that you originally posted so we can see what changes you made.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just multiply the parameter by 100 to get a whole integer, then return the line in the file which has that many digits. Is the file already sorted in numeric value in descending order? If not, then you will probably have to read the entire file and pick out the lines that you want.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Not a movie, but watched a CNN special The British Invasion of America, all about the 50th anniversery of the Beetles in America. Very inteesting, brought back a lot of fond memories from that era.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Wife to husband: Do you rememember last month when two men tried to kidnap me?

Husban: Yes, and an hour later they returned you with their apologies

Wife: I only reasoned with them.

(Diablo 3)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the first sentence I wrote

Compare the parameter list of the function on line 18 with what you are trying to do on line 107. The number of parameters on line 107 must be the same as on line 18, and of the same data types.

The function takes 3 parameters, not just one. Or is there another version of that same function that you have not posted which takes only one parameter?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I told you about 21 hours ago what's wrong, there is no function named getFine() that has only one parameter, or at least you didn't post one.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why are you passing fractional values instead of whole numbers. When you pass 0.02 does that mean to get the line that contains 2 zeros, e.g. 100? Then why not just pass 2 instead of 0.02?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

index+1 first increments index then does the recursive call. index++ doesn't increment index until after the recrsive function call.

It's similar to coding

++index or index++

Somehow that function needs to know the number of elements in the array.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Microsoft IDE can generate some pretty huge inline functions which consume a lot of stack space.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

SOCKET shold be an int, not char because it's value can be a lot larger than what an char can hold.

The file that contains SOCKET declaration is probably not reachable to the *.c file or there could be an #ifdef around it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Try attending all the classes, reading your text book and doing all the exercises in your book. Then you can post specific questions here at DaniWeb along with the code you are trying to write.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The function doesn't make much sense. For example, line 15 is unreachable, If line 5 is false then the only other option is for line 8 to be true. This is a simplified version of your function

   int find_index(int num,int Niz[],int index){



       if(num == Niz[index])
        return index;

       find_index(num,Niz,index++);

       return -1;

   }

Besides that, that happens when num is not in the array at all? The recursion continues infinitely because there is nothing to stop it and the value of index keeps incrementing forever.

A simple loop would be a lot more efficient for this purpose than recursion.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That thread looks ok to me.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Compare the parameter list of the function on line 18 with what you are trying to do on line 107. The number of parameters on line 107 must be the same as on line 18, and of the same data types.

line 18: why is totalFine a parameter to the function? Isn't totalFine what that function is supposed to calculate? It would make more sense if the function parameters were like this:

int getFine(int speedingType, int speedLimit, int vehicleSpeed)
{
   int totalFine = 0;
   ...
   ...
}   

Also, the if statements on lines 22, 30 and 38 are incorrect. Use == operator, not the = assignment operator. That would actually be better as a switch statement.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you write GetFloat()? Post it's source code so that we don't have to guess what it does.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Open the file in append mode the write a line to it. The os will put the new line after the last line of the file. See the a+ flag here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think there are any languages with 10,000,000,000 (10 Billion) words. But if you have a file with that many random words (many duplicates I suppose) then sort it in small chuncks, save the sorted chuncks in their own files then finaly merge-sort all the files. If you sort in chuncks of 1 million words then there will be 10,000 files to merge sort.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

look in limits.h for exact ranges for your compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the previous post -- some of the colors are already in that post and they are all defined in windows.h. Console programs have very limited colors, the same as old MS-DOS 6.X from 30 years ago.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

learn both languages then you will most likely know how to do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

"gobbeldygook" is another favorate. It describes pretty well what politicians say.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

HereClick Here you go.

rubberman commented: Ain't Google Search great!? :-) +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The C API don't help you, if by C api you mean standard C language. You need to study operating system specific API such as win32 api for MS-Windows.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To make a working progress bar you have to split up the work into small units so that the screen can be updated periodically. Depending on what work is being done that may or may not be possible. For example if writing or copying a very large file once the operarating system is called to do the work the os has complete control over the program and it will be impossible to update the progress bar. I know of a couple MS-Windows api functions which accept a pointer to a callback function for that purpose. Don't know about *nix api. Even then, it's on one or two api functions out of thousands that are like that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

this is what I meant

int counter = 0;
for (int i=0; i < num ; i++)
    {
        if (findNum[i] >= 0)
        {
            ++counter;
        }

    }
cout <<"The number of positive integers are " << counter << endl;
cout <<"The number of negative integers are " << num - counter << endl;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

c++ is probably the most used by good game developers, but it's not the easiest. IMO the easiest would be VB.NET because it's graphics are much easier than other languages.

I'm not a game programmer, but if I were I'd spend a lot of time here and on google.

where should i go for good graphics?

Draw them yourself.

DeanMSands3 commented: Because AD is always awesome. +5
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you didn't post the loop, but you need to declare a counter before the loop starts then increment it every time a positive integer is encountered inside the loop. Only after the loop finishes should you display the final count.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The F*** bomb, because it can mean so many different things depending on the context in which it's used. But, unfortunately, many people just overuse it which just trivializes it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Since it's text mode and not GUI a better looking progress bar is probably not possible.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

have you scanned the computer for viruses and malware?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sounds like normal behavior -- your computer is going into sleep mode. Turn it off (click this)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When the file fails to open it means one of two things: (1) you mispelled the name of the file, or (2) the file isn't in the same folder as where the program is running.

Questiion 1: Write the data out in a different format. write() just writes out the data exactly as it appears in memory, which is why write() works so fast. If you want the file readable, then don't use write() but use a series of cout calls.

Question 2: Yes, but it's pretty complicated process. First you have to learn the Structured Query Language (SQL), there are many tutorials, just google for them. There are also several entire books on that topic that you can get from amazon.com or your local book store.

Unless this is a requirement of your assignment I don't think it will be worth your time/effort to implement SQL in this program. Learn it if you wish, but IMO it's overkill.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why are you mixing gets() and puts() which are C functions with cin and cout which are c++??? Be consistent, use either C or C++ fuctions but not both.

Replace gets() with getline() and puts() with cout.

Since you didn't post the rest of the program there is no way I can test it myself.

Also, you did not clear the keyboard buffer after entering the account number as you were instructed in previous posts. Can't help you if you fail to read and/or follow instructions.