Could Use Some Help Here With My Code

Im getting Initilizer Expression list treated as compound expression

Whats gone wrong?

#include <windows.h>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;

int main ()
{
std::string input1;
std::string& replace(" ", "-",input1);

std::string input2;


std::string input3;
std::string input4;

ofstream myfile;

cout << "Please Enter Name..." << endl << endl;
cout << "Name: ";
cin >> input1;
cout << "" << endl << endl << endl;

cout << "Please Enter Password..." << endl << endl;
cout << "Pass: ";
cin >> input3;
cout << "" << endl << endl << endl;

myfile.open ("user Info.txt");
myfile << input1 << "\n";
myfile << input3;
myfile.close();
system("pause");
return(0);
}



Thanks In Advance
I'd say it's this line right here: std::string& replace(" ", "-",input1); since that's not how you use a member function. Check out this page: http://www.cplusplus.com/doc/tutorial/classes/

and please put you code between [code] tags [ /code]
closed account (zb0S216C)
Please, use a compiler other than the out-of-date MinGW compiler that ships with Dev-C++.

PS. I noticed you're from Stoke too :) I never thought I'd see the day.

Wazzak
Topic archived. No new replies allowed.