Cout only prints half of what is requested RRS feed

  • Question

  • I am very new to Visual Studio (first course in college using this program or doing any coding at all) so I am not very good with it yet. But I am doing a project using C++ and when I debug my code, it only prints half of my cout and I'm racking my brain trying to figure it out. Below is my code (with some info removed since this project is asking us to display our personal information). Any assistance is greatly appreciated, just know my knowledge of the program isn't very extensive. 

    //This program will provide my personal information
    #include <iostream>
    #include <string>
    using namespace std;

    int main()
    string name = "(MY NAME)", 
       address = "(MY HOME ADDRESS)", 
       phone = "(MY TELEPHONE NUMBER)", 
       major = "Cyber Security";

    cout << "My name is " << name << ". " << endl <<
        "My address is " << address << ". " << endl << 
        "My telephone number is " << phone << ". " << endl <<
        "My college major is " << major << ". " << endl;
    return 0;


    What I get out is:

    My telephone number is (MY TELEPHONE NUMBER).

    My college major is Cyber Security.

    (The name and address do not print)

    • Edited by GodkinMP Thursday, September 5, 2019 1:01 AM
    Thursday, September 5, 2019 12:59 AM

All replies

  • Your code works for me so the problem is external to what you have posted.

    Sam Hobbs

    Friday, September 6, 2019 6:36 PM