C++ :: How To Search And Display The Total Between 2 Days

Apr 25, 2013

how to search and display the total between 2 days without using lots of code

View 3 Replies


ADVERTISEMENT

C/C++ :: Counting Different Variables And Display Total

Feb 15, 2015

The project has to ask for ten grade inputs with a "for" loop and depending on the grade you input you either receive an "outstanding", "satisfactory", or an "unsatisfactory" output. At the end of the program I am supposed to display the total count of each category, total count of all categories and the average grade. The problem I have is that I cannot figure out a way to calculate what I have to display.

#include <iostream>
using namespace std;
int main() {
double grade = 0;
int g;
for (g = 0; g < 10; g ++) {

[Code] ....

View 2 Replies View Related

C++ :: Display Numbers In Binary Search Tree - Getting 0s

Jan 31, 2015

I want to display the numbers in a bst but all I get are 0s, what is wrong with my code that is causing this?

#include <iostream>
using namespace std;
class binarySearchTree {
private:
class TreeNode {
friend class binarySearchTree;
int value;

[Code] ....

View 1 Replies View Related

C/C++ :: Display Number Of Comparisons Using Binary Search

Apr 23, 2015

My assignment is "Search Benchmarks: Write a program that has a sorted array of at least 20 integers. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should also keep count of the number of comparisons it makes. Display these values on the screen."

I'm unsure how to make it show the number of comparisons it takes to find the value for the binarySearch function. Also, where to put the selectionSort function the teacher said we need. This is what I have...

#include <iostream>
using namespace std;
int linearSearch(const int a[], int num);
int binarySearch(const int a[], int num);
void selectionSort(int a[]);

[Code] .....

View 1 Replies View Related

C/C++ :: Search For Word In Text File And Display Entire Row Once Found

Apr 1, 2014

i've been trying to figure out to search for a word in a text file and then display everything in the same row as the word found int ie this is whats in the file

john doe 3/21/1920 tech support review team 45,000

so user wants to find tech..and everything associated with it.

so program search for tech, when it does it then display the whole row.

john doe 3/21/1920 tech support review team 45,000

I can figure out how to search for a word, but no clue how to get it to then print out the row. This is all I can figure out to do.

ifstream FileSearch;
FileSearch.open("employee");
if(FileSearch.is_open())
{string letters;// search word would be store here
string row; ??stores entire row as string
while(1)

[Code]....

View 14 Replies View Related

C++ :: Read Data From A File Then Store / Search And Display Using Classes And Arrays

Apr 12, 2013

A company uses two text files: one to store employees' details and another to log their sign in/out time.

The details file - called details.txt" has the following format: ID, Name, Date of Birth, SSN, Department, Position - separated by spaces.

An extract from the file looks like this:

10 alice 4/23/1972 123-45-6789 support assistant
3 bob 6/7/1980 111-12-1134 logistics manager
1 carol 10/2/1963 987-123-1143 admin ceo
2 dave 10/3/1974 902-22-8914 admin cfo
17 erin 6/13/1991 126-83-1942 technology supervisor
15 frank 2/22/1987 303-12-1122 logistics assistant

"timelog.txt" contains daily logs of when employees arrive and leave. It has the following format: ID, Date, Arrival Time, Departure Time - separated by spaces. An extract from the file looks like this:

10 2/11 0900 1700
3 2/11 0930 1730
1 2/11 1100 2000
2 2/11 1000 1530
17 2/11 0900 1700
10 2/12 1000 1830
3 2/12 0930 1730
1 2/12 1100 1900
2 2/12 1030 2000
17 2/12 0900 1700
15 2/12 1100 1600

I have to write a program that searches for specific records using some search parameter, and displays them. Ok first i have to read the data from the files and store them. this is what i have so far....

#include <iostream> //Accesses libaries for console input and output
#include <fstream> //Needed to access the fstream object to read files
#include <string> //Needed to access the string class
#include <cstdlib>

[Code] ....

I know my class and array code is totally wrong i dont know how to store the data for the info is in integer and string form... do i use strings, arrays?

View 1 Replies View Related

C :: Array Add Total Rows And Total Columns

Apr 16, 2013

Code: i am trying to display the information in the array as a table and add the total rows and the total colums separately

#include<stdio.h>
int main(void)
{
int row, col;

[Code].....

View 1 Replies View Related

C++ :: Days Of Week Program

Feb 10, 2015

I am in a computer science class at LSU and i can not figure out how to writhe this program. The program must let the user input (MM/DD/YYYY) and then output what day that date was on and also if it was a leap year or not.

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++ :: Function To Find Out How Many Days Have Passed Since Last Birthday

Feb 20, 2013

I have to write a c++ program with my own function which consists of two parameters (day, month). Function have to return number of days since the begining of this year. Using this function i have to find out how many days are left till birthday (or how many days have passed since last birthday)

This is how far i am:

Code:

#include <iostream>
using namespace std;
int cikDienu(int diena, int menesis);
int main()

[Code] ....

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++ :: Read Date From File To Determine Different Days?

Mar 22, 2014

How do I read a date from a file to determine different of days

For example my date.txt contains:

1 23/01/2012 05/02/2012

Currently my code is:

#include<iostream>
#include<fstream>
using namespace std;

[Code].....

View 14 Replies View Related

C/C++ :: Read Date From File To Determine Different Days

Mar 21, 2014

How do I read a date from a file to determine different of days

For example my date.txt contains:

1 23/01/2012 05/02/2012

Currently my code is:

#include<iostream>
#include<fstream>
using namespace std;
class Date {
public:
int day;
int month;
int year;
int total_day;
Date();

[Code] ....

View 1 Replies View Related

C++ :: Program To Convert Timestamp To Hour And Days

Jan 17, 2015

I need to write a program that converts timestamp to hour and days.

View 2 Replies View Related

C++ :: Compare Date And Show Difference In Days

May 20, 2012

I have a file, 'date-list.txt' which has date in it. For example , 20 May 2012 .

Now I want to compare this date with current system date and show the difference in days .

How can i compare dates and shows difference in days in C++.?

View 5 Replies View Related

Visual C++ :: Calculating Number Of Days Between Dates

Mar 19, 2014

I have a code that calculates the number of days between dates. It considers leap years and different days among months. The problem I have is when i debug the code nothing comes out.

Here is the code.
#include<iostream>
#include<fstream>
using namespace std;
bool wheep();
int daysinmonth();
bool wheep(int yr) {
if (yr % 400 == 0)

[Code] ....

this is the file its reading
1 7 9 1 10 9

View 3 Replies View Related

C++ :: Search And Find The Shortest Queue And Search After Some Condition?

Mar 7, 2013

I am trying to implement a Task scheduler where i have n number of tasks. The Idea behind my task scheduler is that in a loop of queues of a vector, task should get enqueued to the shortest queue among the loop of queues, which is done by the following code.

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
int min_index = 0;
task t // implemented in the other part of the program

[Code] ....

Next i am trying to extend this paradigm to reduce the overhead time of the scheduler, Instead of searching the shortest queue every time, search after some condition ie. search the shortest queue after 5 tasks gets enqueued to the shortest queue.

i need to do something like this

#include <vector>
#include <queue>
std::vector<std::queue<int> > q
task t // implemented in the other part of the program
while(q[min_index].size()!=q[min_index].size()+5) // check whether current min_index queue's size is increased 5 more times if not goto enqueue

[code].....

View 1 Replies View Related

C :: How To Compare Days By Dates Of First Week Of 1997 To 2014

Jan 14, 2014

I want to compare dates of first week of every year input by user to determine that what was the day on 02/01/1998 compare to 02/01/2014, or 04/01/2001 compare to 04/01/2003.

I want to compare from 01/01/1997 , 07/01/2014.

For example user enter first date 04/01/2002 and other date 04/01/2003, then the program show that there was tuesday on 04/01/2002 and monday on 04/01/2003.

[Code] ......

View 5 Replies View Related

C++ :: Create Function That Performs Addition Of X Days At A Time?

Jan 26, 2012

I need to create a function that performs the addition of x days at a time, taking two integer values, the first being a date (yyyymmdd format) and a number of days to add / subtract that date.

How can I perform validation if the entire amount received is a valid date and how can I add x days of that date?

View 8 Replies View Related

C++ :: Calculate Number Of Days Between Dates - Program Continuously Runs

Mar 24, 2014

I have an assignment to write a program that will calculate the number of days between two dates (including leap years). We have to read the data from a file and in my current input file I have:

1 1 2000 1 5 2004
5 2 2005 2 5 2009
1 15 1998 1 15 2001

for testing purposes. When I run the program the console runs continuously spouting out "The days between your two dates are 1097." Which would be the correct output for the last set of dates entered, but I need to find out where I've messed up in my main.

#include <iostream>
#include <fstream>
using namespace std;
bool isLeap(int x) {
if (x % 400 == 0) {

[Code] .....

View 7 Replies View Related

C Sharp :: Windows Service To Call Stored Procedure Every 30 Days

Jul 24, 2012

Just now I started learning Windows services.I want to create a windows Service that will call the stored procedure every 30 days.

View 1 Replies View Related

Visual C++ :: Employee Class - Number Of Vacation / Sick Days Used

Oct 21, 2012

Can not even say this is the error as it is giving me 45 errors. l am writing code which accept employee type based on calculating the miles traveled in a year,my code is based on type of employee, number of vacation days used and no of sick days used.

#include <iostream>
#include <iomanip>
#include <conio.h>
class employee {
int emp_type;
float emp_vacation;

[Code] ....

View 11 Replies View Related

C++ :: Binary Search And Sequential Search Algorithm

Sep 16, 2013

Write a program to find the number of comparisons using the binary search and sequential search algorithms

//main.cpp
#include <cstdlib>
#include <iostream>
#include "orderedArrayListType.h"
using namespace std;
int main() {
cout << "." << endl;

[code]....

View 4 Replies View Related

C++ :: Binary Search Or Linear Search For 3D Array

Oct 7, 2014

inputting a search array. I tried putting a binary search but I can't get it to work. everything else works up until I put the value I am searching for in the array, then it just crashes.

How it suppose to work: input 2 coordinates with a value each then it calculates the distance between them then it suppose to let user search the coordinates for a value and state if found which coordinate it is at.

#include "stdafx.h"
#include <iostream>
#include <iomanip> //for setprecision
#include <math.h>

[Code].....

View 3 Replies View Related

C/C++ :: Creating A Class To Store Value That Represents Number Of Hours / Days Worked

Feb 22, 2014

Create a class to store a value that represents number of hours worked and number of days worked. Must ensure that the two representations are always consistent. I have to create 2 files, I'm pretty sure: a .cpp and a .h

This is what I have so far for my .h file (I know it's NOT functional...yet):

#include <iostream>
using namespace std;
class NumDays {
private:
double hours;
double days;

[Code] ...

I don't know how to start / create this .cpp file to define the variables.

View 3 Replies View Related

C++ :: Calculate User Birthday In Months / Days / Hours And Minutes From Today Date

Jul 24, 2014

The problem is that I need to figure out the user's birthday in months, days, hours, and minutes from today's date.

Here's what I have so far.

#include<iostream>
#include<cmath>
#include<ctime>
using namespace std;
int main() {
int todayDay, todayMonth, todayYear;
int birthDay, birthMonth, birthYear;

[Code] ....

I haven't initialized all the variables, yet. And it's very unfinished. I need to figure out how to convert years from the age into months only. And I need to figure out how to calculate the hours, seconds, and minutes.

View 3 Replies View Related







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