| faieq92 (150) | |
| if I open the file before call the function visual studio doesn't have a definition for Data Entry.? | |
|
|
|
| faieq92 (150) | |||||
this is what I have now | |||||
|
Last edited on
|
|||||
| faieq92 (150) | |
|
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(479) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(479) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(479) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : expects 3 arguments - 2 provided 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(468) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(448) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(448) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(448) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &&' from 'std::ostream' 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(448) : see declaration of 'std::getline' 1>c:\users\faieq\documents\visual studio 2010\projects\attempt 2 challange 1\attempt 2 challange 1\attemp2.cpp(177): error C2780: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &&,std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem)' : expects 3 arguments - 2 provided 1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\string(395) : see declaration of 'std::getline' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== THese are the error messages I get now | |
|
|
|
| Imadatobanisa (647) | |
|
You should format your error message. Most likely those are compling errors. Try to correct those errors, please look at line e.g string(line position) string(395). If you need help, copy the error line with code and post them here. | |
|
|
|
| faieq92 (150) | |||
| |||
|
Last edited on
|
|||
| faieq92 (150) | |
| like that? | |
|
|
|
| faieq92 (150) | |
| any ideas? | |
|
|
|
| fun2code (1227) | |
|
Try this; 1) Change every 'cout' to 'cin' where it appears in getline(). 2) initialize i=0 on line 3. 3) Change every 'member' to 'Data[i]'. 4) Eliminate the 3rd parameter Details &member.
| |
|
Last edited on
|
|
| faieq92 (150) | |
|
am I glad to see you it says member is an undeclared identifier. | |
|
|
|
| fun2code (1227) | |
| member doesn't belong in your SaveData(). Did you miss one? It should be gone completely. | |
|
|
|
| faieq92 (150) | |
|
getline(cin, member.FirstName); in here??? | |
|
|
|
| faieq92 (150) | |
| nevermind I ignored point 3 | |
|
|
|
| faieq92 (150) | |
|
getline(cin,Data[i].FirstName); like this? | |
|
|
|
| faieq92 (150) | |||
Now I have this give me a heap of errors xD | |||
|
|
|||
| faieq92 (150) | |||
lots of this | |||
|
|
|||
| fun2code (1227) | |
|
OK. Try fixing the first problem and lets see how the error messages change. i is an undeclared indentifier because the for loop begins and ends on line 3 (due to the extra ; on that line). | |
|
|
|
| faieq92 (150) | |||
|
that's all it was. Suprises me sometimes how it is sometimes the most simplest of things .. ok so this function has replaced my DataEntry array right?
| |||
|
Last edited on
|
|||
| faieq92 (150) | |||
also these are now merging for some reason? | |||
|
|
|||
| faieq92 (150) | |
|
so when I go to input it comes out like this First Name: Last Name:ENTER SOMETHING agE IS fine because I did cin >> age; | |
|
|
|
| fun2code (1227) | |
|
The function has replaced it, but I wouldn't stay with that myself. The DataEntry() function is where the "magic" of writing a Details object to a file occurs. You could call it from your SaveData() function (which would make your SaveData() function have very little code), but you would have to change a couple of things. You can't open and close the file everytime DataEntry() is called. Passing an ofstream object (to the open output file) should work. You would open and close the file in SaveData(). Option B is you just leave SaveData() as is. It will do the job fine. I didn't understand the merging problem. Could you explain it again please? | |
|
Last edited on
|
|