Showing results for 
Search instead for 
Do you mean 
Reply
Dec 04 2006
By: BGamer00090 Treasure Hunter 5377 posts
Offline

More C++ Help!

2 replies 1 views Edited Dec 4, 2006
I have to write 3 functions. I already ddi one of them but the other 2 are giving me problems. Here's the other two...

1. Write a fuction DisplayWithCommas() that displays any long up to 10 digits using commas. For example, 1234567 should be displayed as 1,234,567.

Here's what I have so far (it won't compile btw):

#include<iostream.h>
void DisplayWithCommas();
{

cin>>DisplayWithCommas;
if(DisplayWithCommas<100000000000)
 return (true);
 else
 return (false);
 
 

cout<<(DisplayWithCommas/y%d)<<","<<(DisplayWithCommas%d/y/y)<<","<<endl;
 
}

 

And the second one:

 

Write a function GetChar(), that obtains a character from the user that falls within the two character arguments given. Use the header:

char GetChar(char Lo, cahr Hi)

For example, the following code will return A,B,C,D,E, or F and assign it to Grade:

Grade = GetChar ('A', 'F')

 

Here's what I have for it (which won't compile either):

#include<iostream.h>

 


char GetChar(char Lo, char Hi)
{
char Grade;

 

Grade = Getchar(char lo='A',char hi='F');

if(char lo='A'&& char hi='F')
 cout<<"A,B,C,D,E,F";
  if(char lo='B'&& char hi='E')
  cout<<"B,C,D,E";
   if(char lo='C'&& char hi='D')
    cout<<"C,D";


}

 

Very confused. Any help would be greatly appriciated.

 


Photobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image Hosting
Photobucket - Video and Image Hosting
Please use plain text.
Message 1 of 3 (1 View)
Reply
0 Likes
Treasure Hunter
Registered: 01/06/2006
Offline
7280 posts
 

Re: More C++ Help!

Dec 4, 2006
I can't code in c++ well, but are there any =1 or =0 or function sets, i am only 12, i can't possible master this, i have mastered Javascript and Half of HTML.

Bgamer wrote:
I have to write 3 functions. I already ddi one of them but the other 2 are giving me problems. Here's the other two...

1. Write a fuction DisplayWithCommas() that displays any long up to 10 digits using commas. For example, 1234567 should be displayed as 1,234,567.

Here's what I have so far (it won't compile btw):

#include
void DisplayWithCommas();
{

cin>>DisplayWithCommas;
if(DisplayWithCommas<100000000000)
 return (true);
 else
 return (false);
 
 

cout<<(DisplayWithCommas/y%d)<<","<<(DisplayWithCommas%d/y/y)<<","<
 
}

 

And the second one:

 

Write a function GetChar(), that obtains a character from the user that falls within the two character arguments given. Use the header:

char GetChar(char Lo, cahr Hi)

For example, the following code will return A,B,C,D,E, or F and assign it to Grade:

Grade = GetChar ('A', 'F')

 

Here's what I have for it (which won't compile either):

#include

 


char GetChar(char Lo, char Hi)
{
char Grade;

 

Grade = Getchar(char lo='A',char hi='F');

if(char lo='A'&& char hi='F')
 cout<<"A,B,C,D,E,F";
  if(char lo='B'&& char hi='E')
  cout<<"B,C,D,E";
   if(char lo='C'&& char hi='D')
    cout<<"C,D";


}

 

Very confused. Any help would be greatly appriciated.

 





Signature removed by Admin due to advertising of a commercial nature.
Please use plain text.
Message 2 of 3 (1 View)
Reply
0 Likes
Treasure Hunter
Registered: 09/07/2004
Offline
5377 posts
 

Re: More C++ Help!

Dec 4, 2006
Nope I can't use any of those. You must be pretty smart to master those two languages only being 12 years old.
Photobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image HostingPhotobucket - Video and Image Hosting
Photobucket - Video and Image Hosting
Please use plain text.
Message 3 of 3 (1 View)
Reply
0 Likes