1 Replies - 1159 Views - Last Post: 11 December 2012 - 09:47 AM Rate Topic: -----

#1 Iky  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 26-November 12

make the main program send the original number back to function

Posted 10 December 2012 - 07:03 PM

hi. im not sure how the main program will send the original telephone number in my program to a second function. the first function just reads in the telephone number and the second function
breakoriginalnumber
breaks the number into three parts and print them. this is what the output should look like from this function:
(718) 343-3243      is the  original number
718 is the area code         343 is the exchange      3243 is the extension 


this is my main function and the first function:
int main()
{
    string telephone[14];
    int i = 0;
    
    while (cin) {
        i++;
        readoriginalnumber (telephone[i]);
        cout<< endl;
        
    }
    return 0;
}

void readoriginalnumber (string &) {
    string telephone[14];
    int i = 0;
    
    cout<< "Enter your telephone number" << endl; 
    getline (cin, telephone[i]);
    return;
}


all i know right now is that my breakoriginalnumber gets three reference parameters. thank you for your help.

Is This A Good Question/Topic? 0
  • +

Replies To: make the main program send the original number back to function

#2 jimblumberg  Icon User is offline

  • member icon


Reputation: 3987
  • View blog
  • Posts: 12,298
  • Joined: 25-December 09

Re: make the main program send the original number back to function

Posted 11 December 2012 - 09:47 AM

Show what you have tried. You say your function has three parameters, what are they?

Jim
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1