# include & lt; Stdio. H>
# include
#include
# include
#include
#include
using namespace std;
The class LofFile
{
Public:
LofFile () {
F.o epn (" the TXT ");
}
Void shared_print (string id, int value)
{
Lock_guard & lt; Mutex> Locker (m_mutex);
F & lt; <"From" & lt;}
Private:
Mutex m_mutex;
STD: : ofstream f;
};
Void function_1 (LofFile& The log) {
for (int i=0; I & gt; - 100; I -)
The shared_print (" the from ti: ", I);
}
Int main () {
LofFile log;
Thread t1 (function_1, ref (log));
for (int i=0; i <100; I++)
The log. Shared_print (" from the main ", I);
T1. The join ();
}
1> -- -- -- -- -- - has started to regenerate: all projects: multithread, configuration: Debug Win32 -- -- -- -- -- --
1> The main. CPP
1> C: \ users \ will \ documents \ visual studio 2015 \ projects \ multithread \ multithread \ main CPP (14) : error C2039: "oepn:" not "STD: : basic_ofstream & lt; Char, STD: : char_traits & lt; Char> & gt;" A member of the
==========all regenerated: zero success, failure, skip the 0==========
CodePudding user response:
Isn't it obvious? Is open, not oepnCodePudding user response:
CodePudding user response:
About whether he is suitable for programming is very simple test:On a newspaper or magazine articles, for a period of about 1000 words in Word input again, after losing to refer to the following answer:
A. there are more than 10 words or punctuation
B there is no words or punctuation mistakes and dare to bet for this
No words or punctuation errors and C fonts and layout fully consistent with the original
D print on the translucent paper and check the same original overlap, and feel very with a sense of accomplishment
A is not suitable for programming (reason: typing accuracy is low, careless)
B junior programmer (reason: typing accuracy high, careful and meticulous, confident, understand the whole Angle of half Angle concept)
C senior programmer (reason: in the B on the basis of understanding the font and layout is also an important factor of computer to print, but compared to D paranoid enough, strives for perfection, the results can verify)
D software project manager (reason: to be able to give convincing for project detailed requirements to the pole and typical test cases, users almost pick is not at fault, major!)
If want to from A to B, to my resources http://download.csdn.net/detail/zhao4zhong1/4084259 download "for programmers keyboard practice"
CodePudding user response:
Both please oepn your eyes