Computing.Net > Forums > Programming > Can some help me to change this C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Can some help me to change this C++

Reply to Message Icon

Name: eason li
Date: October 18, 2002 at 07:33:24 Pacific
OS: mocrosoft
CPU/Ram: 128
Comment:

A)I want the follow program can be able to edit name or number and delete entries as contact details change.b) I want my program can select a Menu which includes search, Add, Edit, Delete or exit;

This is the program i made.(Can you help me to change my program to what i mention at the two points at the top?)


//Visual C++ 6
#include
using namespace std;

#include

#include

int main()
{
char filename[12];
cout>filename;

ofstream outFile;
outFile.open(filename,ios::app);

if(!outFile){
cerr> name >> homephone >> mobile ) {
outFile < cout <<"? ";
}

outFile.close();

return 0;
}



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: October 18, 2002 at 09:31:11 Pacific
Reply:

You need to learn to walk before you can run.

Your program has numerous simple errors that indicate that you are pretty new to programming and don't have a good understanding yet.

- you declare the variable filename and attempt to use it in a cout before putting a value into it.

- cout > filename - I don't use cout and cin but I'm sure that the brackets used with cout must be <<. Again, filename is not initialized.

- you are using an uninitialized 'filename' to attempt to open a file

- cerr - shouldn't the brackets be <<

- outfile < cout << "?"; - at least the brackets are pointing the correct direction, but I don't think that this is a valid cout statement.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Can some help me to change this C++

come and help me in c++ please! www.computing.net/answers/programming/come-and-help-me-in-c-please/4001.html

Can anyone help me w/ C++? www.computing.net/answers/programming/can-anyone-help-me-w-c/3472.html

python - can anyone help me solve this questi www.computing.net/answers/programming/python-can-anyone-help-me-solve-this-questi/19887.html