C/C++ :: Output Number Of The Day Based On Month Day And Year - Check Leap Year

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


ADVERTISEMENT

C++ :: Program To Check The Leap Year

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

C++ :: Program That Outputs Calendar For That Month When Given Month And Year

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

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 View Related

C++ :: Generate Calendar For A Year - Day Of Week Month Starts From

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

C :: Program That Determine Day Number In A Year For A Date?

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

C/C++ :: Compare Time Fetched From Two Week Number Of Different Year?

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

C/C++ :: Day Of The Year Program

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

C++ :: Show Weekday For Given Year

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

C++ :: Program To Generate Calendar For A Year

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

C :: Program To Calculate Business Days In A Year

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

C++ :: How To Print Any Input Year In Digital Block Form

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

C++ :: Convert String Variable For The Year To Integer Data Type

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

C++ :: Converting Month Number To Month Name Using Exception Classes

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

C :: Program To Show Highest Negative And Lowest Positive Temperature Of Year

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

C++ :: Date Class - List Major Holidays And Print Calendar For Given Year

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

C++ :: Printing Number Of Days In A Month

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

C++ :: Program To Output A Check With Correct Spacing

Oct 14, 2013

So I have to write a program that outputs a check with correct spacing and everything.

Create a project titled Lab7_Check. Write a program that asks the user the check information and prints the check. The dialog should be as follows:

date: 2/23/2010
name: William Schmidt
amount, dollars: 23
cents: 30
payee: Office Max

your check:

William Schmidt 10/13/2013
pay to: Office Max $23.30
twenty three and 30/100 dollars

You may assume that a person always has the first name and last name (no middle names or initials). The payee name is also always two words. The dollar and cent amount are integers and the amount is always less than 100 dollars. Note that the dollar amount could be zero, in which case, when you spell the dollar amount, it should print "zero". The date is always a single (non-white space separated string). Your date, dollar amount in numbers and the word "dollars" have to vertically align.

This is the code I have so far.

#include <iostream>
#include <string>
using namespace std;
int main(){
string date;
string firstname;
string lastname;

[Code] .....

View 3 Replies View Related

C++ :: Program To Check If Phrase Is In File And Output The Result

Jun 6, 2013

I wrote a program that should check if phrase is in file and output the result.

File:
//////////////
Eat my shorts!
Ay Carumba!
Stupid Flanders...
////////

Why my program doesn't cout?

#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
using namespace std;
string checkData (char Input[], char dataB [], int nMAX){

[Code] .....

View 2 Replies View Related

C++ :: Creating Frog Leap Game That Starts At 1 And Finishes At 12

Feb 13, 2015

I have been given the task of creating a frog leap game that starts at 1 and finishes at 12. The layout is as follows. The '@' symbols are just included to show blank white space.

1-----2 @@ 3---4
|@@ |@@@ |
|@@ |@@@ |
5@@ 6------7-----8
|@@ @@@ |@@ |
|@@ @@@ |@@ |
9----10 @ 11 @12

Each number within the game will represent an object, the user will have to reach the 12th leaf start from leaf 1. the frog can only move in the directions of forwards backwards, left and right. Any starting points? E.g. using and array or list? i have a feeling this is going to be a big task. is inheritance possible?

View 1 Replies View Related

C++ :: Visual Studio 2013 - Leap Motion Virtual Piano

Sep 10, 2014

I currently have a project that requires me to build a leap motion Virtual Piano. I am using Windows Visual Studio 2013 and i plan to use C++ to code it.

I assume my first step is to create a virtual piano using C++.. Then, link it with leap motion interface.

Can i know which audio library suits my project and how can i go about doing it?

View 1 Replies View Related

C++ :: Input Decimal Number And Output To Be Number Scientific Notation

Apr 26, 2013

I need to write a code in c++ , to input decimal number and the output to be number in Scientific notation with 32 bits .

View 1 Replies View Related

C++ :: Receive Number From User And Output Largest Prime Number

Nov 20, 2014

I am attempting to write code that receives a number from the user and outputs the largest prime number underneath the user's number. There are no errors in my code, but no matter what number is imputed, the program says the largest prime number is 1. I cannot find where the issue is in the code. Here is the code I wrote:

#include <cstdlib>
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int num);//function prototype

[Code] ....

View 2 Replies View Related

C++ :: Negative Number Check

Sep 30, 2013

The code on lines 44-53 is suppose to display a message when the user enter a negative number, however, when a correct positive number is entered the message is display again.

#include<iostream>
#include<cctype>
using namespace std;
int main() {
char carType;
int A, B, C;

[Code] ....

View 2 Replies View Related

C :: How To Repeat A Loop Based On Number Inputted By User

Oct 21, 2014

How can i repeat a loop based on the number inputted by the user?

View 4 Replies View Related

C++ :: Count Number Of Distinct Edges Using Set Based Algorithm

Sep 8, 2014

So I have this set

13
14
24
31
62
35
36
42
13
44
62

now using sba or Set Based Algorithm I have to pair it out and towards the end find the size of the resulting set

#include <iostream>
#include <set>
int main()

[Code]......

this is the code just reads the edges that's 3... that is when we input the code. But what if its in a file? how do I read from there and show the paired count and the time taken?

Also I have the file that works and reads any txt file..but how do i get the code from it?

[URL]

this is the file..you have to run it as ./edgecount for it to work

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved