Thread: Problems With My Project

  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
    Chappell Hill, Texas
    Posts
    2,332
    You should use a string, not individual chars.
    Mainframe assembler programmer by trade. C coder when I can.

  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, 09:34 PM
  2. Project details: Dedicated
    By Stack Overflow in forum Projects and Job Recruitment
    Replies: 9
    Last Post: 02-22-2005, 03: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