2 Replies - 2839 Views - Last Post: 25 September 2011 - 03:16 PM Rate Topic: -----

#1 baseline30  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-January 11

Write a code that simulates the dialing of a program using functions

Posted 24 September 2011 - 10:12 PM

Im writing a program that simulates the dialing of a phone can some one please tell me what's wrong with code
I'm new to programming and was wondering if I can get a little help in what I'm doing wrong I will appreciate the help. from anyone who is willing help. THANKS Here is my code. O I'm getting error message saying to many arguments in call functions

#include <iostream> 
#include <iomanip> 
#include <string> 
using namespace std; 

int readDials(); 
void toDigit(); 
void acknowledgeCall(); 

int main() 
{ 

// Declaring variables 
string num; 
char one, two, three, four, five, six, seven, eight; 

cout << "Enter a phone number: "; 
cin >> num; 

one = num[0]; 
two = num[1]; 
three = num[2]; 
four = num[3]; 
five = num[4]; 
six = num[5]; 
seven = num[6]; 
eight = num[7]; 

readDials(one, two, three, four, five, six, seven, eight); 

return; 


int readDials(char &one, char &two, char &three, char &four, char &five, char &six, char &seven, char &eight) 
{ 
if(one == 0) 
return -2; 
else if (one == 5 && two == 5 && three == 5) 
return -3; 
else if (four != '-') 
return - 4; 
else 

toDigit(); 
} 


void toDigit(int & d) 
{ 
toupper(d); 
switch(d) 
{ case 'A': case 'B': case 'C': 
d = '2'; break; 
case 'D': case 'E': case 'F': 
d = '3'; break; 
case 'G': case 'H': case 'I': 
d = '4'; break; 
case 'J': case 'K': case 'L': 
d = '5'; break; 
case 'M': case 'N': case 'O': 
d = '6'; break; 
case 'P': case 'Q': case 'R': case 'S': 
d = '7'; break; 
case 'T': case 'U': case 'V': 
d = '8'; break; 
case 'W': case 'X': case 'Y': case 'Z': 
d = '9'; break; 
} 

void acknowledgeCall(); 
{ 
char phoneNumber; 
cout << "Phone number dialed: " << phoneNumber << endl; 
} 

}


This post has been edited by no2pencil: 25 September 2011 - 12:06 AM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: Write a code that simulates the dialing of a program using functions

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1762
  • View blog
  • Posts: 3,417
  • Joined: 30-May 10

Re: Write a code that simulates the dialing of a program using functions

Posted 24 September 2011 - 11:37 PM

This
int readDials();

Needs to match this
readDials(one, two, three, four, five, six, seven, eight);

and this
int readDials(char &one, char &two, char &three, char &four, char &five, char &six, char &seven, char &eight)

Likewise, when you try to call toDigit();, it is expecting a parameter.
Was This Post Helpful? 1
  • +
  • -

#3 baseline30  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-January 11

Re: Write a code that simulates the dialing of a program using functions

Posted 25 September 2011 - 03:16 PM

Thanks for the help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1