i have this code to be written in C. i was to make an atm with a unique pin no. required. my prof gave me a copy of the program in c++ and asked me to "convert" it in C. how do you do that? there are so many seperate codes and i dont know how to make them just a simple single program.this are the programs:

this are the other codes:

Here are just a few helpful hints: They are not all inclusive and you will no doubt encount other problems during the porting process.

1. rename the *.cpp files to *.c files
2. convert the classes in the .h files to normal structures and make the class methods just standard C functions, passing an instance of the structure to the function.

3. delete the class constructors and destructors. They are not relevant to C language.
4. replace functions such as void account::deposit (const double &amount) to standard c functions, such the following, adding an instance of the structure as the first parameter. objects passed by reference have to be passed as pointers, not c++ references.

void deposit (struct account * acct, const double*amount)
{
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.