to store the dialled contacts in call log

Hello everyone, Can someone solve this problem? I've written the function. But it is not displaying any contact as dialled numbers.

void PlaceCall(int j)
{
char S[4]="YES",s[4],E[4]="END";

cout<<"\nDial this no.?\n "<<Name<<" "<<MobNo<<endl;

cin>>s;
if(stricmp(s,S)==0)
{
cout<<"\nDialling...\n"<<Addressbook::Name<<" "<<Addressbook::MobNo;
cout<<"\nPress END to end the call\n";
while(1)
{
cin>>s;

if(stricmp(s,E)==0)
{
cout<<"Call ended\n\n"
<<"Call Details:-\n\nDate: " ;
cout<<__DATE__<<"\tTime: "<<__TIME__<<"\n\n";
break;
}
}
}
else cout<<"\nCall Cancelled\n";

call[c]=j;
c++;

}

void Display(Log a[])
{

cout<<"Names\tDialled Numbers\n";
for(int j=0;j<c;j++)
{
int i=call[j];
cout<<a[i];
}
}
Are you referring to the Display() function? I suspect that the value of c isn't what you expect. Try printing it out with some temporary code or examine it in a debugger. Also, a single letter name for a global variable is a bad idea.

If PlaceCall isn't working as expected, try printing out the contents of s after you input it.
Line 21: __DATE__ and __TIME__ are not going to give you the current date and time. They are macros that resolve to the date and time of compilation.

Line 33: You haven't shown the declaration of Log.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Topic archived. No new replies allowed.