C :: Calendar Doesn't Work
Sep 24, 2013
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;
[Code]....
View 10 Replies
ADVERTISEMENT
Nov 21, 2013
#include <iostream>
#include <string>
using namespace std ;
int main() {
string bored ;
do {
cout << " program" <<endl ;
[Code] .....
I made this as a simple do/while program, and if i run it, the second do/while statement will keep on going forever, without the [cin >> bored;] line working?
View 2 Replies
View Related
Jun 9, 2014
I've implemented it a bit differently: I create 2 temporary arrays, one for the numbers lower from the pivot , an done for numbers greater then the pivot. in the end of each iteration the 2 arrays are copied to the original array:
Code: #include <iostream>
void QuickSort (int* A , int start, int end){
if (end-start<3){
return;
}
int mid=(start+end)/2;
int pivot=A[mid];
int lA[end-start] , rA[end-start], rCounter=0,lCounter=0;
int curr=0,i=start;
[code]....
View 3 Replies
View Related
Dec 9, 2013
I am trying to release my C++ app to run on desktops that dont have VS installed and have created an install shield app to install on the desired computer. my issue is even after packaging it, it still requires certain DLL's...I read online that I had to copy 'msvcr120.dll' and a few others to syswow64 and sys32 folders but now when I try run my app it just crashes before starting.
I think it sucks that Microsoft no longer packages required DLL's like it used to in 2010.
View 1 Replies
View Related
May 14, 2014
Ive been having a hard time creating bin file. Whenever I append data, the data wont show in browse function. And this program works good without the bin file code.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
[Code]....
View 2 Replies
View Related
Sep 28, 2013
my text for the score and difficulty doesn't seem to work. They are both appearing twice and not updating. The score text worked fine until I inserted the difficulty text and I can't seem to find the problem. URL.....
#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>
int main()
{
sf::ContextSettings settings;
//settings.antialiasingLevel = 8;
[code]....
View 2 Replies
View Related
Nov 1, 2012
i'm right now using C, IO is done via ncurses, but that won't affect the following problem, i think. The relevant code is:
#define SIDEBARWIDTH 27
//...
typedef struct {
[Code]...
surprisingly this works, now the new 3rd outputline is correct again. So it seems that the printcommand has some troubles with accessing the struct here. Not sure if that might be ncurses fault. Still feels odd.
View 2 Replies
View Related
Jun 11, 2014
Code:
#include <iostream>
using namespace std;
int main () {
char character = 'a';
[Code] .....
the point of this code is to increase character by 1 (so from a to b in this case).
The line highligted in red is the line that the system is rejecting at the moment (but there may be other issues). why it is invalid?
View 5 Replies
View Related
Aug 27, 2013
I should reduce the number of bitmaps I used in my code. I translated my particle engine into code that could be compiled as plain standard C
Currently, the code has a segmentation fault somewhere that I can't figure out. How it should function is that it takes orders from a queue for new lasers to store the instances in a linked list. It then takes that data and updates its coordinates, one node at a time. The first node should also be the first node to complete its life, so it gets removed, and the list is set to the next node in memory. If there are no more nodes left, a if-statement should catch it and either break the current loop, or wait for more items to be requested. If there are nodes left, the process will continue to remove the first node in the list until there are none left. Obviously this is not quite how it works. When I tested in once in SDL, the laser would update every 5 frames, but wasn't shown constantly, and would crash after the node was to be disposed of. When I initialize with the SDL parachute, it would exit before I event saw the screen. Also, the code I translated to standard C will display that the laser has been updated to the screen, but it never says that it has moved up. It crashes after about 4 printf() statments execute. My debugger has been giving me mixed SIGTRAPS, and "nothing is wrong" output. Here is the code in standard C:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_LASER_QUEUE 10
}
[code]....
View 6 Replies
View Related
Jan 1, 2014
Im about to program a RPG and, of course, the player has got an inventory. The items in this inventory are stored in a linked list and have IDs in form of strings.
player.cpp: (just the most relevant)
#include <list>
#include <string>
using namespace std;
[Code] ....
Of course, when the player saves the game, the inventory has to be saved too.
game.cpp(just the m. R.)
#include <fstream>
using namespace std;
class CGame{
[Code] .....
Now, in my code I write the linked list into the file savegames.sav
void CGame::save(CPlayer* player){
m_out.open("savegames.sav", ios::out);
m_out.write((char* ) &player->m_inventory, sizeof(player->m_inventory));
m_out.close();
}
In another function i load the list:
void CGame::load(CPlayer* player){
m_in.open("savegames.sav", ios::in);
m_in.read((char* ) player->m_inventory, sizeof(player->m_inventory));
m_in.read();
}
And when i access the loaded linked list with the .empty() function or so, Windows says the following:
<Mygame.exe> funktioniert nicht mehr (in English: doesnt run anymore).
I tried so much to fix that but i dint reach my aim.
View 2 Replies
View Related
Feb 5, 2013
I realized a Matrix class to practice and I have a problem I can not solve! Here my problematic code:
Mtrx.h:
Code:
template <class T>
Mtrx::Mtrx(dim m, dim n, const bool random_constructed = false, const T min = static_cast<T>(0), const T max = static_cast<T> (10))
Mtrx.C
[Code] ...
And here the relative main section:
Code:
Mtrx rand1 ( 5, 5, bool);// ok
cout<<rand1<<endl;
Mtrx rand2 ( 7, 3, bool, -5, 20);// ok
cout<<rand2<<endl;
Mtrx rand3 ( 7, 7, bool, 0., 15.);// compilation error: undefined reference to
// "Mtrx::Mtrx<double>(unsigned long, unsigned, bool, double, double)"
// collect2: error: ld returned 1 exit status
I compiled in a Linux OS with g++ -std=c++11
View 3 Replies
View Related
Feb 19, 2013
I wrote a program with function my own function which count the digits of entered number. The problem is whatever i type it shows 0 digits.Why is that?
Code:
#include <iostream>
using namespace std;
int cikCipari (int skaitlis, int cipars);
int main()
[Code] .....
View 7 Replies
View Related
Nov 12, 2014
Title is self-explanatory.
Code:
#include <iostream>
using namespace std;
int main ( ) {
float number;
float sum;
float divi;
while(number != -1) {
[Code] .....
View 5 Replies
View Related
Aug 28, 2014
I installed FLTK 1.3.X from [URL] on my visual studio 2012 compiler and use PPP book for C++ programming [URL]. My problem is about filling a Shape in.
Code:
#include <Simple_window.h>
using namespace Graph_lib;
int main() {
Simple_window win(Point(100,100), 1000, 600, "Binary_tree");
Graph_lib::Circle c(Point(200,200),50);
c.set_color(Color::red);
[code]....
When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?
This [URL] is the .CPP and .h files ( )
View 6 Replies
View Related
Apr 27, 2014
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);
[Code]......
View 1 Replies
View Related
Sep 25, 2014
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;
[code].....
View 2 Replies
View Related
Dec 7, 2014
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.
#include<iostream>
using namespace std;
#define TRUE 1
#define FALSE 0
char *months[] = {
" ",
[Code] ....
View 6 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
Jul 10, 2014
I have made a calendar using a resource file and using the winapi
CALENDAR_DLG DIALOG 0, 0, 186, 95
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Calendar"
FONT 8, "Ms Shell Dlg" {
CONTROL "", CALENDAR, "SysMonthCal32", WS_VISIBLE, 0, 0, 186, 95
}
My call back function is
BOOL CALLBACK DlgCalendar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch(uMsg) {
case WM_INITDIALOG: {
} return TRUE;
[Code] .....
DTN_DATETIMECHANGE is not being called ? What is UMSG equal to when a date is changed in the calendar?
View 5 Replies
View Related
Jan 14, 2014
I have a problem. I want to write a program that gives me the current calender for example like this:
June 2009
Su Mo Tu We Th Fr Sa
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
and I shouldn't use windows.h
View 2 Replies
View Related
Dec 5, 2012
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:
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
After the last day of the calendar is displayed, the function should advance the cursor to the next line.
Note that for the display above, the start day is 3 and the numbers of days is 31.
View 1 Replies
View Related
Nov 30, 2013
I have a class Calendar which has an attribute of priority queue, that accepts records of structure defined as:
typedef void (Calendar::*eventPointer)();
struct activationRecord {
double Time;
int Priority;
eventPointer activationEvent;
};
And here is the problem. Whole day I've been trying to fill the Calendar with some test entries by calling the method
void Calendar::calendarPush(double Time, int Priority, eventPointer event)
This is how I call it
calendar.calendarPush(Time, Priority, &Calendar::calendarEmpty);
But Visual Studio keeps to warn me with this error
argument of type "bool (Calendar::*)()" is incompatible with parameter of type "eventPointer *"
#include <iostream>
#include "Calendar.h"
using namespace std;
int main() {
cout << "Initializing ..." << endl;
double Time = 0.0;
int Priority = 0;
[Code] ....
View 4 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
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
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
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