Problems With My Project

This is a discussion on Problems With My Project within the C++ Programming forums, part of the General Programming Boards category; Code: #include <iostream> using namespace std; int main(){ char a,b,c,d,e,f,g,h,i,j,k; cout << "Please enter your first name\n"; cin >> a ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Problems With My Project

    Code:
    #include <iostream>
    using namespace std;
    
    int main(){
        char a,b,c,d,e,f,g,h,i,j,k;
        cout << "Please enter your first name\n";
        cin >> a >> b >> c >> d >> e >> f;
        cin.ignore();
        cout << "You entered -"<< a << b << c << d << e << f;"-  Is this correct?\n";
        cin.get();
    }

    I'm trying to get this project to display the name that a user types and then ask if its correct. It displays the name but doesn't ask if its correct. I'd appreciate your help.
    -pat3lbr0s2014-

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    You should use a string, not individual chars.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by pat3lbr0s2014 View Post
    Code:
    #include <iostream>
    using namespace std;
    
    int main(){
        char a,b,c,d,e,f,g,h,i,j,k;
        cout << "Please enter your first name\n";
        cin >> a >> b >> c >> d >> e >> f;
        cin.ignore();
        cout << "You entered -"<< a << b << c << d << e << f;"-  Is this correct?\n";
        cin.get();
    }
    The character I made bold is wrong here and should be replaced by two others...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. First "big" project and having problems...
    By rabbit in forum C++ Programming
    Replies: 1
    Last Post: 02-11-2006, 08:34 PM
  2. Project details: Dedicated
    By Stack Overflow in forum Projects and Job Recruitment
    Replies: 9
    Last Post: 02-22-2005, 02:10 PM
  3. Convert C++ project
    By gogo in forum Tech Board
    Replies: 6
    Last Post: 08-12-2004, 07:48 AM
  4. Operating System Project
    By Pete in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 07-15-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21