Can someone help me !!

This is what I have written so far
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*********************************************************
* file name: average.cpp
* programmer name: your name here
* date created: 9/02/10
* date of last revision: 9/02/10
* details of the revision: none
* short description:  Calculating the average of 3 numbers
**********************************************************/
#include <string>
#include <iostream>

using namespace std;

void instructions();
int main()
{
     // Program description
     instructions();
    // Declare the variables for the string and the separated words
   
}
void instructions()
{
	string fourWords, splitString, wordOne, wordTwo, wordThree, wordFour, reversedWords;
    int asterPos;
   
    // Ask for the words separated by asterisks
    cout << "Enter for words seperated by an asterisks " << endl;
    cin >> wordOne, wordTwo, wordThree, wordFour;
	

    splitString = fourWords;
    // Separate the words
    asterPos = splitString.find("*");
    wordOne.assign(splitString, 0, asterPos);
    splitString.erase(0, asterPos + 1);
     …..
    // Concatenate the words in reversed order
    fourWords = wordOne + wordTwo + wordThree + wordFour;
    // Show the words in the original order and the new order.
      cout << fourWords << endl;
    return(0);


*Write a program that reads a string containing exactly four words (seperated by * synbols) into a single string object. NExt extract each word from the orginial string and store each word in a string object. Then concatenate the words in reverse order to form another string. Display both the orginal and final string strings *

These are my instructions but I don't understand them fully. Can someone explain seperating the words part and can you tell me if what I have is somewhat right
It's asking to read 1 input and store it into 1 string. Not four inputs into 4 strings. Like:
1
2
Please enter 4 words separated by '*'//program prompt
hello*i*am*george //user input 


Afterwards you're supposed to take that 1 long string and parse it into 4 separate strings like what lines 34 to 36 are starting to do.

Then finally, like line 39, reverse the order and put them back together into a new string (presumably each is still separated by *)
Last edited on
Topic archived. No new replies allowed.