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


ADVERTISEMENT

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

C :: How To Get Current Weekday

Aug 31, 2014

I'm new in C and I want to know how to get the current weekday where sunday=0, monday=1,...,.(using time.h if possible)/I want to do something like

Code:

#include<stdio.h>
#include<time.h>
int main(void)
{

[Code]....

View 3 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 :: 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++ :: 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 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 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 :: 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++ :: 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++ :: 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/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++ :: 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++ :: 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++ :: 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# :: How To Show A Frame Of Gif

Jan 10, 2015

I want to show a frame of a gif image. I searched and found that the following code should work, but it doesn't work. it detects the number of frames correctly but it shows the whole frames of gif instead of the specified frame.

Image[] frames = new Image[36];
Image GG = Image.FromFile(@"C:UsersAdministratorTEST C#TEST2frame2chef.gif");
FrameDimension dimension = new FrameDimension(GG.FrameDimensionsList[0]);
// Number of frames
int frameCount = GG.GetFrameCount(dimension);
label1.Text = frameCount.ToString();
// Return an Image at a certain index
GG.SelectActiveFrame(dimension, 1);
frames[1] = ((Image)GG.Clone());
pictureBox1.Image = frames[1];

View 2 Replies View Related

C/C++ :: Show All Subset Of A Sub?

Feb 6, 2014

A program is a set of all subsets of this part of the show. Users can enter a number., For example, if n = 2 the output looks like this:

{}
{1}
{2}
{1,2}
or for n=3 we have:
{}
{1}
{2}
{3}
{1,2}
{1,3}
{2,3}
{1,2,3}

meantime this program should be solved with tow way. recursive function and Non-recursive.Can also be used in solving the problem of bitwise operations.

View 2 Replies View Related

C :: Can't Show The Proper Float Value

Jul 7, 2014

I am working from my "ansi c" book by steven lawlor, page 73 program 2. write a program that accepts two numbers from the keyboard and prints the following information.

variables
first
second
execution
First number ? 7
Second number ? 2
the second goes into the first 3 times
with a remainder of 1.
the quotient is 3.5.

Code:
#include <stdio.h>
main() {
int first, second;
scanf(" %1i %1i", &first, &second);
printf("First number ? %1i

[Code] ....

//I included this as I had some error message come up
// before, not sure if this is correct though?
} it shows what is expected but I cant get the 3.5.

I have tried %f and variations of width/precision but still not luck. Also, when I click on the application and put in the variables I press enter, the program executes and disappears so I cant see the result. how do I get the program to stay up until I want to get rid of it?

View 1 Replies View Related

C++ :: Show First Non-Repeating Character?

May 25, 2013

How to show First Non-Repeating character?
"r"

#include <iostream>
#include <string.h>
#define MAX 100

[Code]....

View 7 Replies View Related

C++ :: How To Show At Least Two Numbers In The Output Instead Of One

Dec 12, 2014

I would like to know if there's a way to show at least two numbers in the output instead of just one. For example: instead of showing 4 it shows 04. Its for a console application.

View 3 Replies View Related

C++ :: How To Show Output On Screen

Oct 29, 2013

I want to write a program that makes this output to appear on screen using for-loop :

0 0
1
2
3
4
5

1 0
1
2
3
4
5

2 0
1
2
3
4
5

3 0
1
2
3
4
5

I can't seem to make the correct logic/engine of this nested loop.

View 11 Replies View Related

Visual C++ :: DialogBox Show Nothing?

Sep 17, 2012

I've got this slice code inside a DLL:

Code:
DWORD processId;
HWND hwndParent;
BOOL CALLBACK enumWindowsProc(HWND hwnd, LPARAM lParam)
{

[Code]...

Why id doesn't show any Dialog?

View 3 Replies View Related

C :: Show Contents Of A File On Screen

Nov 22, 2013

The aim will show on the screen but does not show the contents of a file on the screen different shows.

Code:
#include <stdio.h>
#include <conio.h>
main() {
char filename[100];
double xx;
int ii, kk;

[Code] .....

View 12 Replies View Related

C :: System Will Show Segmentation Fault

Mar 11, 2013

i'm writing a C code, can it can be compiled, however everytime I run this program, after I typed in the number the system will show Segmentation fault (core dumped).

Code is here
C code - 278 lines - codepad

View 7 Replies View Related

C++ :: Show Percentage When File Is Being Updated

Jun 19, 2014

I want to update a file but I want to show the percentage when it is being updated. How can I do this? Do I need to use threads?

View 2 Replies View Related







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