Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralI know... Pin
CPallini29-Nov-07 3:07
mveCPallini29-Nov-07 3:07 
GeneralRe: VC 2005 compiler error Pin
toxcct28-Nov-07 1:34
toxcct28-Nov-07 1:34 
GeneralRe: VC 2005 compiler error Pin
neha.agarwal2728-Nov-07 1:38
neha.agarwal2728-Nov-07 1:38 
GeneralRe: VC 2005 compiler error Pin
toxcct28-Nov-07 1:40
toxcct28-Nov-07 1:40 
GeneralRe: VC 2005 compiler error Pin
Cedric Moonen28-Nov-07 1:47
Cedric Moonen28-Nov-07 1:47 
GeneralRe: VC 2005 compiler error Pin
neha.agarwal2728-Nov-07 17:36
neha.agarwal2728-Nov-07 17:36 
GeneralRe: VC 2005 compiler error Pin
David Crow29-Nov-07 2:51
David Crow29-Nov-07 2:51 
QuestionHelp with a couple of C questions Pin
3alawii27-Nov-07 23:57
3alawii27-Nov-07 23:57 
Hiya guys i seem to have this rather annoying problem, i'm trying to finish a 9 question assignment on C, however i have managed to finish 7 of those but am stuck on two of them. I tried finding hints/tips on the internet as well as try to understand the topic from library books but i still can't seem to understand the whole thing. Anyways i stumbled upon this site and i really need your help. If anyone can solve these two questions for me i would really appreciate it.

1- The day of the week for any given date can be calculated using Zeller's congruence, which can be neatly programmed into a computer. The technique is detailed below.

Assume that "year", "month" and "day" have been given as three integers, for example 1965, 8, 23 respectively for August 23rd 1965. The calculation continues.

if month < 3 then
month=month+12
year=year-1
end if

Then

nd=((13*month+3)\5+day+year+year\4-year\100+year\400)mod 7

The sign \ is used to indicate integer division (ignore the remainder) – to achieve the desired result simply use integers for everything (some languages, C not being one, actually have an ‘integer devision’ method). The "mod 7" terms means find the remainder after dividing by 7. Note: in C Mod is calculated in C using the ‘%’ , ie 16%8 is 16 mod 8 = 0

The result, nd, gives the day: 0 is Monday 1 is Tuesday etc. T
he formula is (of course!) year 2000 compliant, but only extends back to the Gregorian calendar revision, which occurred at different dates in different countries.

Ask the user to enter the day, month & year then, calculate ‘nd’ and then use this value in a switch statement where the ‘cases’ are enumerated variables defined for the days to display the relevant day of the week.

2- Unions:
You are required to create a union containing the various integer and float types and an array of unsigned chars.
The size of the array of chars should be the number of bytes used for storage of the largest variable type
Assign values to the various members of the union and then display the values of the bytes used for storage.
Extend the program from part 1 such that the bytes are displayed using a single function which is passed your union & the no of bytes for the type assigned.

Using your union from above ask the user to enter an integer value. Display the bytes used for storage.

Swap the bytes used in storage and then display the new byte sequence and the ‘new’ integer value. You should do this for ALL integer types > one byte in size.

Once again if anyone could help me with this i would really appreciate it, and i look forward to hearing from anyone soon. Thanx a lot.

Hayan
AnswerRe: Help with a couple of C questions Pin
manish.patel28-Nov-07 1:31
manish.patel28-Nov-07 1:31 
AnswerRe: Help with a couple of C questions Pin
manish.patel28-Nov-07 1:36
manish.patel28-Nov-07 1:36 
AnswerRe: Help with a couple of C questions Pin
David Crow28-Nov-07 3:26
David Crow28-Nov-07 3:26 
AnswerRe: Help with a couple of C questions Pin
BadKarma28-Nov-07 3:36
BadKarma28-Nov-07 3:36 
Questionnfo Pin
john563227-Nov-07 23:24
john563227-Nov-07 23:24 
AnswerRe: nfo Pin
toxcct27-Nov-07 23:28
toxcct27-Nov-07 23:28 
GeneralOfftopic Pin
Nelek28-Nov-07 3:13
protectorNelek28-Nov-07 3:13 
GeneralRe: Offtopic Pin
toxcct28-Nov-07 3:18
toxcct28-Nov-07 3:18 
GeneralRe: Offtopic Pin
Nelek28-Nov-07 21:43
protectorNelek28-Nov-07 21:43 
GeneralRe: Offtopic Pin
toxcct28-Nov-07 21:47
toxcct28-Nov-07 21:47 
QuestionConsult the issue of Win API routine address and code injection Pin
Jude Deng27-Nov-07 23:04
Jude Deng27-Nov-07 23:04 
AnswerRe: Consult the issue of Win API routine address and code injection [modified] Pin
maciu202028-Nov-07 0:20
maciu202028-Nov-07 0:20 
GeneralRe: Consult the issue of Win API routine address and code injection Pin
Jude Deng28-Nov-07 14:48
Jude Deng28-Nov-07 14:48 
GeneralRe: Consult the issue of Win API routine address and code injection Pin
maciu202028-Nov-07 23:15
maciu202028-Nov-07 23:15 
QuestionRe: Consult the issue of Win API routine address and code injection Pin
David Crow29-Nov-07 2:43
David Crow29-Nov-07 2:43 
AnswerRe: Consult the issue of Win API routine address and code injection Pin
maciu202029-Nov-07 9:47
maciu202029-Nov-07 9:47 
AnswerRe: Consult the issue of Win API routine address and code injection Pin
Jude Deng29-Nov-07 13:26
Jude Deng29-Nov-07 13:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.