Program (C ++) written at on January 2, 201811

Source: Internet
Author: User

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 ####

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.