Thread: MSVC++ .NET Help

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    18

    MSVC++ .NET Help

    I am trying to compile the following:

    Code:
    #include <iostream>
    
    
    int main()
    
    {
    	int number1;
    	int number 2;
    	int sum;
    
    	std::cout << "Enter the first integer\n";
    	std::cin >> number1; //Read the information and store it inside a variable
    	std::cout << "Enter the second number!\n";
    	std::cin >> number2;
    
    	sum = number1 + number2;
    	std::count << "The sum is:" << sum << std::end1;
    	 
    	return 0;
    
    }
    And it gives me the following errors:

    ------ Build started: Project: What Ever, Configuration: Debug Win32 ------
    Compiling...
    What Ever.cpp
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(9) : error C2143: syntax error : missing ';' before 'constant'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(15) : error C2065: 'number2' : undeclared identifier
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2039: 'count' : is not a member of 'std'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2065: 'count' : undeclared identifier
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2039: 'end1' : is not a member of 'std'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2065: 'end1' : undeclared identifier
    Build log was saved at "file://e:\Documents and Settings\x\My Documents\Visual Studio 2005\Projects\What Ever\What Ever\Debug\BuildLog.htm"
    What Ever - 6 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Code:
    #include <iostream>
    
    
    int main()
    
    {
      int number1;
      
      //Remove the space between number and 2
      //Number2 is now not defined due to typo
      int number 2;
    
      int sum;
      std::cout << "Enter the first integer\n";
      std::cin >> number1; //Read the information and store it inside a variable
      std::cout << "Enter the second number!\n";
    
      //Won't compile because number2 not defined
      //due to typo earlier on
      std::cin >> number2;
    
      sum = number1 + number2;
      
      //It's std::cout not std::count - typo
      //It's std::endl not std::end1
      std::count << "The sum is:" << sum << std::end1;   	 
    
      return 0;
    
    }
    And it gives me the following errors:


    ------ Build started: Project: What Ever, Configuration: Debug Win32 ------
    Compiling...
    What Ever.cpp
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(9) : error C2143: syntax error : missing ';' before 'constant'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(15) : error C2065: 'number2' : undeclared identifier
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2039: 'count' : is not a member of 'std'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2065: 'count' : undeclared identifier
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2039: 'end1' : is not a member of 'std'
    e:\documents and settings\x\my documents\visual studio 2005\projects\what ever\what ever\what ever.cpp(18) : error C2065: 'end1' : undeclared identifier
    Build log was saved at "file://e:\Documents and Settings\x\My Documents\Visual Studio 2005\Projects\What Ever\What Ever\Debug\BuildLog.htm"
    What Ever - 6 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    If you would have read the compiler messages this would have been easy to fix.

    Everything here is due to typos and you now owe me some money for doing your job.

    Do us a favor and go into your editor settings. Tell it to use spaces instead of tabs.
    Last edited by VirtualAce; 06-27-2006 at 11:05 PM.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    18
    I can't seem to find anything like that in the options.

    Can anyone help?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MSVC 2005 .NET Intellisense issues
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 09-19-2006, 03:04 PM
  2. Difference in MSVC 6 & MS VC .Net
    By passionate_guy in forum C Programming
    Replies: 1
    Last Post: 01-23-2006, 06:39 AM
  3. Some .NET Distribution Stats
    By nickname_changed in forum C# Programming
    Replies: 2
    Last Post: 05-14-2005, 03:41 AM
  4. debugging in msvc .NET
    By thebitmaster in forum Windows Programming
    Replies: 1
    Last Post: 12-13-2003, 03:11 PM
  5. Visual J#
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 10-08-2001, 02:41 PM