User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 426,560 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,687 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums

need help on C-string

Join Date: Dec 2005
Posts: 6
Reputation: fidelljf is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fidelljf fidelljf is offline Offline
Newbie Poster

Re: need help on C-string

  #5  
Dec 1st, 2005
i could have used strings for the middle name which would be the same thing, i was just trying a couple of different things. i know how to use the vectors but I dont know how to use stringstreams. I got lost when you used: istringstream iss(line); while ( iss >> line ) I guess we are limited into using strings and vectors only. I tried to run your program but it would not work. And one more thing our instructor warned us of using one whole string and using getline. He suggested to use three different strings.

I modified my program so that I used three strings. thanks for your help

#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;


int main()
{ using namespace std;

string first_name, middle_name, last_name;


cout << "Enter your first name, middle name or initial and last name in that order\n";
cin >> first_name >> middle_name >> last_name;
cout << endl;
cout << last_name << ", " << first_name << " " << middle_name[0] << "." << endl;

return 0;
}
Reply With Quote  
All times are GMT -4. The time now is 8:57 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC