i need to write a program that takes this style of input

Enter customer name: Kristopher Ann#Nugent

and seperates the name to look like this

Customer name: Nugent, Kristopher Ann


so far i have decided to separate the name into 3 separate character strings but i can only get two of them to store

char first[255], middle[255], last[255];
  float quantity, price, total, discount_total, final;

  cout << "Enter your name in First Middle#Last format.";
  cin >> first;
  cin >> middle;
  cin.ignore(1, '#');
  cin >> last;

Recommended Answers

All 3 Replies

so i guess what i need to do is to create a flag in the input to stop when it hits the "#" if anyone knows how to do that i would be very grateful because my way isn't working

Look at the getlin() method.

I'm lookin at some of that stuff but still struggling could you maybe show me some syntax

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.