C :: Calculating First Tuesday Of Any Month In Given Year?
Jul 1, 2013
I'm trying to determine the first Tuesday of any month in a given year.. I'd prefer to use my own functions to arrive at a solution, but logically I could sorting these things out.
View 6 Replies
ADVERTISEMENT
Feb 14, 2015
Whenever I run the program I get no errors yet it doesn't return a value for total it just exits the program. The program is supposed to output the number of the day based on the month day and year and check whether it is a leap year.
#include <iostream>
using namespace std;
int totaldays();
int days();
int month, day, year;
bool leap();
int main() {
char dash;
cout << "Enter the date in mm-dd-yyyy format to find out what day this is in the year." << endl;
[Code] ....
View 2 Replies
View Related
Mar 17, 2013
i am beginner in c++ , i need to write a programm that out ouputs a calender for a month when given a month and year using this frame work :
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
using namespace std;
[code].....
View 8 Replies
View Related
Oct 18, 2013
So for my C++ class I am required to create a program that will "Write a program to generate a calendar for a year. The program should accept the year and the day of the week for january 1 of that year (0=Sunday, 1=Monday, etc.)" (problem statement) and I am completely stuck. I've posted what I have so far below:
#include <iostream>
#include <iomanip>
using namespace std;
bool isLeapYear(int year);
int daysInMonth(int month, bool lpYear);
int printCalendar(int month);
int printDay(int dow);
[Code] .....
View 3 Replies
View Related
Oct 29, 2013
program that prompts the user to enter a person’s date of birth in numeric form such as 8-27-1980.The program then outputs the date of birth in the form: august 27, 1980.Your program must contain at least two exception classes; invalidDay and invalidMonth.
View 1 Replies
View Related
Dec 17, 2013
I write this program to print the number of days for the month when the year and the month enters. This is not giving any result and i think that problem is with calling functions.
#include<iostream>
#include<conio.h>
#include<string>
using namespace std;
int leap_year(int year);
string days(string mounth);
string feb(string fab1);
void main(){
int year;
View 8 Replies
View Related
Apr 10, 2013
I am having trouble associating the month names with the month numbers. When the program runs, it should output the date in three styles.
Also I do not know if my input validations work correctly(day cannot be greater than 31 or less than 1, month cannot be greater than 12 or less than 1).
#include <iostream>
using namespace std;
char again;
class Date {
private:
int month;
int day;
int year;
[Code] ....
View 7 Replies
View Related
Oct 21, 2013
So my program is suppose to calculate the rain totals for the month but I get a weird error I've never seen.
ERROR: Unresolved external symbol "double_cdecl wettestMonth(double*const,int)" (?wettestMonth@@YANQANH@Z) referenced in function_main
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//Function Prototypes
double getData();
[Code] ....
View 1 Replies
View Related
May 2, 2013
The objective is to build a month class that hold data on the number of the month and the name of the month. Using constructors and overloads, set it up to where you can input either the month or the name and it will output the results for both the month number and name.
Here is the code I have so far:
#include<iostream>
#include<string>
using namespace std;
class Month{
private: string name;
int monthNumber;
[Code] ....
It is almost fully compiled if I go by the error list. The only problems I see to be having are with the prefix and postfix overloads.
View 5 Replies
View Related
Dec 11, 2014
(I'm using visual c++). Write a program that calculates the balance of a savings account at the end of a three month
period. It should ask the user for the starting balance and the annual interest rate. A loop should then iterate once for every month in the period, performing the following:
A) Ask the user for the total amount deposited into the account during that month. Do not accept negative numbers. This amount should be added to the balance.
B) Ask the user for the total amount withdrawn from the account during that month. Do not accept negative numbers or numbers greater than the balance after the deposits for the month have been added in.
C) Calculate the interest for that month. The monthly interest rate is the annual interest rate divided by 12. Multiply the monthly interest rate by the average of that month’s starting and ending balance to get the interest amount for the
month. This amount should be added to the balance.
After the last iteration, the program should display a final report that includes the following information:
• starting balance at the beginning of the three-month period.
• total deposits made during the three months
• total withdrawals made during the three months
• total interest posted to the account during the three months
• final balance.
What I need is to solve that particular problem using a class. Here is the code solved for the problem not using a class:
#include<iostream>
using namespace std;
int main() {
double annulInterestRate,
balance,
monthlyInterestRate,
[Code] .....
View 8 Replies
View Related
Nov 5, 2014
I have this project, The problem is I have most of the code written, I am just having trouble setting it up correctly and placing it correctly. My code is rather long but as I said I know this is the longer and harder way to go about this.
//This program will be used to find out the day of the year
#include <iostream>
int month, day, year;
bool isALeapYear(int year) {
//Check if the year is divisible by 4 or is divisible by 400
[Code].....
View 14 Replies
View Related
Nov 10, 2014
In this assignment the student should develop a month calendar by designing a class called calendarType . This class uses two other classes (dateType and dayType) as described below:
1. dayType Class: This class has been designed by students in Lab1 exercises. Referee to it.
2. dateType Class: This class is designed and implemented to keep track of data. This class has been provided it to you. Study it first then add definitions and implementations of the following operations to this class:
- Test whether the year is a leap year. Leap year is identified by 3 criteria :
- The year is evenly divisible by 4;
- If the year can be evenly divided by 100, it is NOT a leap year, unless;
- The year is also evenly divisible by 400. Then it is a leap year.
- Return the number of days in the month. For example, if the date is 12/3/2014, the number of days to be returned is 31 because there are 31 days in March.
- Return the number of days passed in the year. For example, if the date is 18/3/2014 the number of days passed is 77. Note that the number of days returned also includes the current day.
- Return the number of days remaining in the year. For example, if the date is
18/3/2014 , the number of days remaining in the year is 288.
- Calculate the new date by adding a fixed number of days to the date. For example, if the date is 18/3/2014 and the days to be added are 25, the new date is 12/4/2014.
To print monthly calendar using calendarType class, you must know the first day of the month and the number of the days in that month. Thus, you must store the first day of the month, which is in the form of dayType and the month and the year of the calendar. Clearly, the month and the year can be stored as an object of the form dateType by setting the day component of the date to 1, and the month and year as specified by user.
Design the class calendarType so that the program print a calendar for any month starting 1/1/ 1500 which is Monday. To calculate the first day of a month, you can add the 2 appropriate days to Monday of January 1, 1500. For this class identify and implement the following operations:
- Determine the first day of the month for which the calendar will be printed. Call this operation firstDayOfMonth.
- set/get month.
- set/get year.
- Print calendar for particular month.
- Add the appropriate constructors to initialize the member variables.
- Write a test program to print the calendar for either a particular year or a particular month.
View 1 Replies
View Related
Jan 23, 2013
I have been given an assignment which I have big troubles with. The assignment is:
"If I ask you “When is the weekday of the 2nd of August in 1429?”, you can answer immediately with your program to my question.
The initial value for the 1st of January in (the year) 1 will be sought by inducing, for example the crucifixion of Jesus is said to be held on Friday, the 3rd of April, AD 33."
How can I solve this?
View 3 Replies
View Related
Oct 15, 2013
Problem: Write a program to generate a calendar for a year. The program should accept the year and the day of the week for January 1 of that year (0 = Sunday, 1 = Monday, etc.). The calendar should be printed in the following form:
January
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
February
1 2 3 4 5
I have wrote code that has three functions, one to print the month, one to print the days in month, and one to find if it is a leap year or not. I have gotten up to the point where I can print the 12 months with a for loop, but how to print out the days in the format above.
This is my code.
#include <iostream>
using namespace std;
void printOneMonth(int month, int& dow, int year);
void daysInMonth(int month, int year, int& dim);
bool isLeapYear(int year);
int main(){
int year=0, dow, count;
[Code]...
View 1 Replies
View Related
Oct 7, 2013
Check the Leap Year Program In C++:
#include <iostream>
using namespace std;
int main() {
int yr;
cout << "Enter year : ";
[Code] ....
Check the LeaP Year... [URL] ....
View 2 Replies
View Related
Oct 21, 2013
Write a program that determines the day number (1 to 366) in a year for a date that is provided as input data. As an example, January 1st, 1994, is day 1. December 31, 1993, is day 365. December 31, 1996 is day 366, since 1996 is a leap year. A year is a leap year if it is divisible by four, except that any year divisible by 100 is a leap year only if it is divisible by 40. Your program should accept the month, day, and year as integers. Include a function leap that returns 1 if called with a leap year, 0 otherwise. Extend the requested solution so that your program continues to prompt the user for new dates until a negative year is entered. This is what I have so far.
Code:
#include <stdio.h>
#include <stdbool.h>
int main(void) {
int d,m,y;
int days=0;
int k;
[Code] .....
I am unsure how to make this a loop so that it keeps asking for dates?
View 9 Replies
View Related
Nov 11, 2014
I need to make a program to calculate the business days (Monday-Friday) in a year in C. As example:
Input
2026
Output
261
I need to consider that the year could be a leap year and that every year can start with a different day. My Problem is that i dont know how to implement the right number of business days in C. I wrote down the business days in Excel for 2010-2040. I cant see any system behind it, some years have 261 business days, some have 260 or 262 but in no order.
View 7 Replies
View Related
Apr 29, 2013
How to print a year like DIGITAL CLOCK NUMBER for any input four digit number ...
For example if input 1000 the output should be 1000 but each number should look like this in the block form for example number 0 is, don't mind those stars, i did not know to print it here, that is number zero ...
======
=****=
=****=
=****=
======
View 1 Replies
View Related
Jul 5, 2012
How to compare the time fetched from two week number of different year using C,C++.
I have used a naming convention for the files generated in a linux system. The naming convention will have the week number and date's day indication like Monday means M. I need to compare the two files of same week but on different years and calculate the time?
View 1 Replies
View Related
May 12, 2014
My intent was to convert the string variable for the year to an integer data type. The code compiles but now cannot run on my system. I'm not sure what's going as to what the program is displaying.
Objective: Prompt the user for two years. Print all Comedy movies that were released between those two years.
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <cctype>
using namespace std;
struct Movie {
string name;
[Code] .....
View 2 Replies
View Related
Jan 19, 2014
I have an assigment and I don't know yet how to write this program :" I introduce the average monthly temperatures of a year(12 values for 12 months). When I compile the program it needs to show the highest negative temparature and the lowest positive temperature of that year.
Example: Entry data: -4 -6 0 5 10 20 24 25 17 8 -1 -7 exit data : max negative= -1 and min positive= 5 "
View 11 Replies
View Related
Mar 20, 2013
I'm trying to implement a Date class to create a simple application for " Major U.S. holidays calendar System ", that provides a list of major holidays for a given year AND prints the calendar for the given year either online or write to a file. I need to finish up the class date.h, which is
#ifndef DATE_H
#define DATE_H
#include <string>
#include <iostream>
using namespace std;
string Month[]={"" , "January", "Febraury", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"};
[Code] .....
View 1 Replies
View Related
Nov 29, 2013
Finally got a programme partially working, why the values are not showing? Is this down to incorrect formula or i havent declared the values etc?
Code:
#include <stdio.h>
#include <math.h>
float timeconstant(float R, float C);
float R;
float C;
float time_c;
[Code] ....
View 2 Replies
View Related
Oct 21, 2013
I've been trying to calculate the Second standard deviation but the average in the second loop isn't calculating correctly which is causing the standard deviation (method 2) to not calculate correctly. I can't find anything wrong.
Code:
#include <iostream>#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
usingnamespacestd;
int main ()
[Code]...
View 8 Replies
View Related
Mar 14, 2013
Currently I am working on a program where you enter in a date 14 03 2013 (Day, Month, Year) and you get the next day. I seem to be coming stuck with months with less than 31 days, and the whole leap year thing. Here is my code so far.
Code:
#include <stdio.h>
int day, month, year, next_day, next_month, next_year, calculation;
int main() {
printf("Enter a date in the form day/month/year: ");
scanf("%d %d %d", &day, &month, &year);
[Code] .....
View 4 Replies
View Related
Feb 19, 2014
As part of a project i want to display the speed of a small wheel on a 7 segment display. I am using a hall effect sensor to pick up the pulses of the rotation. I am not sure how to write a programe on C to calculate the RPM from this....
View 4 Replies
View Related