473,406 Members | 2,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

due on monday

Your assignment is to write a function that inspects an input integer and
// determines the number of 5's and 8's that occur in the input.
// Use the provided main program as your template for the driver.
// The prototype for your function is given below.
//
// *** Submit your lab using the turnin program as directed in the handout ***

// Include your C++ library(s) here (you know, #include < ... >)

void check_Num(long); // function prototype

int main(void)
{
long inputNum = 0;
do{
cout << "\nPlease enter an integer >= 0: ";
cin >> inputNum;
if(inputNum < 0){
cout << endl << "The integer you entered was negative!" << endl;
}
}
while(inputNum < 0);

// Call your function here.

cout << endl << endl;
return(0);
}

void check_Num(long num)
{
// If there were BOTH 5's AND 8's in the input integer ...
cout << "There were " << found5 << " fives and " << found8
<< " eights found in the integer " << num << endl;

// IF there were ONLY 5's found in the integer
// (maybe other digits other than 8's) ...
cout << "There were " << found5 << " fives found in the integer "
<< num << endl;

// If there were ONLY 8's found in the integer
// (maybe other digits other than 5's) ...
cout << "There were " << found8 << " eights found in the integer "
<< num << endl;

// If there NO 5'S AND NO 8'S found in the integer
// (maybe other digits other than 5's OR 8's) ...
cout << "There were no fives or eights found in the integer "
<< num << endl;
}
Jul 17 '07 #1
3 1378
svlsr2000
181 Expert 100+
can u tell where are u struck. If you are looking for a method i this would help you

if 123545 is number you can do some thing like this
x = 123545
if(x%10 = = 5)
increase number of 5

x = x/10;

now x would have become 12354

do this till x becomes 0
Jul 17 '07 #2
just started learning c++ but my prof gave dis assignment very early so i need to call d function but not able to get it
Jul 17 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
// Call your function here.
Why don't you call your function here?
Jul 17 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Eric Linders | last post by:
Hello, Today is Thursday, August 18, 2004. I would like to have a variable that stores the date this coming Sunday (even if today happened to be Sunday) in YYY-MM-DD format. I also need a...
3
by: CrystalDBA | last post by:
I am using SQL Server 2000. I need to query my database for all the contracts that came in during a certain time frame (user is prompted for reportingperiodid). Table - Periods Fields -...
5
by: Martien van Wanrooij | last post by:
I would like to retrieve, let us say, the First Monday after a certain date, so my (imaginary) function could be something like echo weekdayAfter("28 July 2005", "Monday") should return "1 August...
2
by: Joecx | last post by:
Does anyone know how to give a date (not today's date) and have the program calculate the previous monday's date from it? Any help would be appreciated. Thanks!!!! Joe
5
by: Drum2001 | last post by:
Currently I am running the following query: SELECT DateFilter.Employee, DateFilter.TimeTypeIn, sectodur(IIf(Sum(DateDiff("s",,))-40*60*60>0,Sum(DateDiff("s",,))-40*60*60,0)) AS Overtime,...
7
by: bojan.pikl | last post by:
Hi, I am making a calendar. It is costum made and I would like to have the ability to choose the first day (Monday or Sunday). I know for the firstDayOfWeek, but I can't change it. What should I...
4
by: sweetpotatop | last post by:
Hi, I wonder if there is any function in VB or SQL that will return the date of first Monday of the Monday. Besides, is there are a way finding the numbers of Monday in a month? Thanks in...
5
by: Chris | last post by:
I am trying to output Monday of the current week i.e. if Monday is the 8th I want to display 'Monday 8th' for any date between Monday 8-14th. I would appreciate any help, the code below is...
1
by: Frank Rizzo | last post by:
I need to get a Monday of the current week based on any date. I got the function below working fine, but it feels hacky. And I can't find anything in the framework. Is there a more elegant...
4
by: Vince | last post by:
Given a week Number, how do I calculate the date that for the Monday of that week?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.