I've been creating an API and I'm now stuck on callbacks. There are many APIs that allow callbacks to class members(e.g. Windows API) using a void pointer to the object. I've searched the internet for hours and I can't find one example of how to use the "hidden object parameter" of an class method pointer that doesn't use std::function/bind or boost::function/bind. Any information on how API's like Windows API are able to use class methods as callbacks
I want to pass some parameters to a dialog. I am trying to pass a struct as LPARAM in CreateDialogParam. How to access this structure from ONOK for example?
For getting the share folder name i have been used the following code , here i am able to get the folder names . But the problem what i am facing is along with the share folder created by the user it gives some extra folder also , i don't know how to prevent the programe to hide that unnecessary folder names . Like in my case i am getting "cc_views"(used for clearcase) and "Users" folders , which i want to remove from my folder lists .
I made a dialog to have a customizable msgbox. (custom icon, custom caption on buttons). This is how I try to display an icon on the dialog but it is not working.
I just dont see what the issue is here. I have stared at this thing forever. Im trying to make a calendar from scratch so I can be prepared for my second test on Friday.
Code: #include<stdio.h> #include<stdlib.h> int main(void) { int i, n, s;
I am trying to format a Gregorian Calendar that accepts only the year as a user input, but I want the display to show 3 months on one row. I can get January to display correctly, but the February and March months do not.
I think my loop inside of my calendar1 function specifically is the issue:
//Is day before Sat? Else start next line Sun. if ( ( day + daycode ) % 7 > 0 ) cout << right << setw(3);
The object is to have the user enter in the number of days then the day the calendar would start on. This part I was able to achieve and run okay. Once I wanted to get the values/days that were prime to have a P besides them this is where I ran into trouble. In this case P stands for prime numbers.
The issue I have is that some of the values that are prime have the correct P but others have the P as well such as 9, 15, and 25 - which are not prime numbers.
I was able to create a program that checked for prime numbers separately but I had issues merging them. Below is the merged code followed by the prime checker.
#include <stdio.h> int main(int argc, const char * argv[]) { int i, N, Start; int j, GetNumber, PrimeNumber = 0;
In this project a user needs to enter a numeric month and a year. The output is a single calendar month with the name of the month followed by a grid of the days. My issue is that my day alignment is off. for example: if you enter the month of December (12) and this year 2014 it says the month started on a Wednesady when in fact it started on a Monday. I am not sure if its my leap year calculaion or what.
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:
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;
I need to write a function that displays the days of a specified month. I have been looking for sample code but haven't had much luck. Here are the guidelines for the function:
Write a void function named displayCalendarDays. This function is passed two input parameters. The first parameter is an int that represents the start day. Start days are numbered from 0 to 6 with 0 representing Sunday and 6 representing Saturday. The second parameter is an int that represents the number of days in the month. If the start day is not in the range 0 to 6 or if the number of days is not in the range 1 to 31, the program should display useful error message instead of displaying a calendar. If the parameters are OK, the program should display a calendar similar to the following:
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);
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.
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
If we use bitwise-shift to shift all bits to the right by 2, x is 0:
00000000000000000000000000000000
If we then do a bitwise leftshift on x by 30, do we end up with:
11000000000000000000000000000000 or 00000000000000000000000000000000
In other words, when we perform right shift which clips away the least most significant bits, and then do a left shift, is it possible for those bits to reappear?
Here is a simplified version of my Menu class, where submenus can be inserted arbitrarily deep. I need to add a new functionality "go back to previous menu", which I would like to be activated by entering 0 (universal command for all Menu instances). I considered the Memento Pattern, but that doesn't seem to quite fit. add that functionality to my Menu class.
#include <iostream> #include <cstring> using namespace std; const int END = -1, NO_SUBMENU = 0;
I am trying to use push back in a 2D vector but I don't know how to. This is what I have:
vector <vector <BigInt> > matr;
for (BigInt i=0;i<rij;i++) { for (BigInt j=0;j<kolom-1;j++) { matr.push_back().push_back((i+1)^(pow-j)); } }
I quickly invented something but that doesn't work obviously. it should be equivalent to this: (the only problem in the code below is that those indexes don't exist yet that's why I need push_back())
for (BigInt i=0;i<rij;i++) { for (BigInt j=0;j<kolom-1;j++) { matr[int(i)][int(j)]=(i+1)^(pow-j); } }
I'm new here! I just wanted to ask, how can I go back to Main menu using this code that I have made (I know it's not yet finish I'm using Visual Studio c++ 2010! I there are any errors in my codes
Project: Computer Shop System
#include <iostream> #include <string> using namespace std; int pcnum[5],x; //choice pc int pc; int i; //name int y; //hours