Program (C ++) written at on January 2, 201811
Program target: enter a string and output it vertically. Use the string and dynamic memory allocation mechanism. The Code is as follows:
# Include <iostream>
# Include "stdafx. h"
# Include <cstring>
Int main ()
{
Using namespace std;
String s = cin. getline;
Char * a = new char [sizeof (s)];
For (int m = 0; m <sizeof (s); m ++)
A [m] = s [m];
For (int n = 0; n <sizeof (s); n ++)
Cout <a [n] <endl;
Delete [];
Cin. get ();
Cin. get ();
Return 0;
}
Compiler: Visual Studio 2015
The compilation error is displayed, but you do not know how to modify it. Record it here first. I hope you will be enlightened.
Error message:
The severity Code indicates that the project file line cannot be displayed.
Error C2146 syntax error: ";" missing (before identifier "s") MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp10
Error C2065 "s": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp10
Error C2065 "cin": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp10
Error C2228 ". getline" must have a class/structure on the Left/in combination with MyProject_001c: \ users \ administrator \ documents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp10
Error C2065 "s": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp11
Error C2065 "s": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp12
Error C2065 "s": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp13
Error C2065 "s": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp14
Error C2065 "cout": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp15
Error C2065 "endl": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp15
Error C2065 "cin": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp17
Error C2228 ". get" must have a class/structure on the Left/in combination with MyProject_001c: \ users \ administrator \ documents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp17
Error C2065 "cin": Undeclared identifier MyProject_001c: \ users \ administrator \ documents ents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp18
Error C2228 ". get" must have a class/structure on the Left/in combination with MyProject_001c: \ users \ administrator \ documents \ visual studio 2015 \ projects \ myproject_01 \ myproject_001 \ myproject_001 \ myproject_001.cpp18
#### If I want to use an error to start my blog Park trip, I can only improve it without stopping Error Correction ####