C/C++ :: Display Unique Date And Its Related Price Found In Txt File

Apr 23, 2015

Currently i have a system that will store user input into a txt file, and have a function that will compute the daily sales of the month(Check by system date month) and display the sales of the day and the grand total of that month.

Take for example, the system date now check that the current month is Apr. Below are my current output:

20Apr2015 $11.5
20Apr2015 $15.5
22Apr2015 $4.5
25Apr2015 $4.5
28Apr2015 $4.5
20Apr2015 $4.5
Grand Total $45

But my desired result should be as below

20Apr2015 $31.5
22Apr2015 $4.5
25Apr2015 $4.5
28Apr2015 $4.5
Grand Total $45

Textfile data:

1|Bag|2|3|6|20Apr2015
2|Fruit|2.3|5|11.5|20Apr2015
3|Fruit|2.3|5|15.5|20Apr2015
4|Water|0.9|5|4.5|22Apr2015
5|Water|0.9|5|4.5|25Apr2015
6|Water|0.9|5|4.5|20Jul2015
7|Water|0.9|5|4.5|20Jul2015
8|Water|0.9|5|4.5|28Apr2015
9|Water|0.9|5|4.5|20Apr2015

Below are my code.

struct TransactionPile {
// to record item information.
string itemid;
string itemdesc;
float unitprice;
int quantity;
float totalprice;
string date;

[Code] ....

View 6 Replies


ADVERTISEMENT

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/C++ :: Given Person Birth-date Or Any Other Date Will Display Day Of Week

Oct 11, 2012

i'm making a program that, given a person's birthdate or any other date, will display the day of the week of the person was born.

There is this part where it says "use a switch statement to make this calculation, If desired month is 12, add the number of days for November, if desired month is 11 add the number of days for october....

So it's suppose to start with "case 12 :...

I can't figure out what to write for the statement....

View 6 Replies View Related

C/C++ :: Menu Won't Show Display Entire Price?

Apr 15, 2014

I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.

my code:

#include <iostream>
#include <string>
#include <fstream>

[Code].....

View 1 Replies View Related

C/C++ :: Menu Won't Show Display Entire Price

Apr 15, 2014

I am working on a drink machine simulation. I have a text file that holds the prices, names and inventory. My problem is It won't let me set my prices at 1.00 or higher. Ex: I set the price to 1.50 in the text file then when it reads the info and stores the price it only stores .50 instead of 1.50.

textfile looks like this:
Apple Juice 1.50 20
Mango Juice 1.50 20
Sprite Mix 1.90 20
Coca Cola 1.90 20

[Code].....

View 2 Replies View Related

C++ :: Display Pizza Price By Size After User Input

Mar 13, 2014

How can i write a program that allows a user to enter a size of pizza and then print the price for that size.

Example: if a user enters size ''s'' then it should display the price stored under ''s''

View 3 Replies View Related

C++ :: Create A File Which Containing Letters Related With Above ASCII?

Aug 30, 2014

I have a text file which contains ASCII of A,B and C like below,

65
66
67

Now I need to create a file which containing letters related with above ASCII like below, ABC

This is my code.

#include<iostream>
#include<fstream>
#include<string>

[Code]....

View 2 Replies View Related

C++ :: Class / Header File Related Errors

Sep 22, 2014

Here's my class/header, and Visual studio Output.

Injection point/instantiation.

int main() {
Player player;

Call to a public method:
while(!isWin("x", board) && !isWin("o", board) && whoGoesFirst == "p") {
printBoard(board);
board = player.playerTurn(board);

[Code] .....

Output:
1234
1
1> Player.cpp
1>c:users
sccdocumentsvisual studio 2012projectsprog 2100 - assignment 1prog 2100 - assignment 1player.h(10): error C2143: syntax error : missing ';' before '<'
1>c:users
sccdocumentsvisual studio 2012projectsprog 2100 - assignment 1prog 2100 - assignment 1player.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:users
sccdocumentsvisual studio 2012projectsprog 2100 - assignment 1prog 2100 - assignment 1player.h(10): error C2238: unexpected token(s) preceding ';'

View 2 Replies View Related

C++ :: Store Related Data Of Program Into External File?

May 14, 2013

How is it possible to store the related data of a program C++ into an external file (like as .txt) and retrieve it?

I want to write c++ program that can contain data members " id and phone"

like as
Code:
class profile {
private: int id,phone;
public:
void retriever() {
cout<<"Enter your ID: ";
cin>>id;
cout<<"Your Phone number is "<< phone;
};
}

avoiding formats in above class, purpose is to store data already in txt file with different id and phone numbers and it is to be retrieved by matching id number to txt file and viewing its related phone number.

View 1 Replies View Related

C/C++ :: How To Get System Date And Time And Display It

Mar 16, 2012

How to get system Date and Time and display it in the format DD/MM/YYYY ??

View 2 Replies View Related

C Sharp :: How To Display Date Range In Crystal Report In Windows From

Feb 18, 2013

how to display date reange in crysta report , i have table contains :

id score date name
1 30 2-10-2012 x
2 40 3-10-2013 y
3 40 3-7-2009 z
1 45 5-10-2013 x
1 50 4-10-2009 x

ouput report:

id:1 name :x

2009-10| 2012-2013
50 30
40

View 2 Replies View Related

C :: Display Current Time And Date In Program And Use Variable To Store Each Of Values

Feb 16, 2013

i need to display the current time and date in my program and use variable to store each of the time values like

a = 10
b = 29
c = 31

printf(``%d : %d : %d``, a,b,c);

which then give the output as - 10:29:31

How to save the time in variables in C....

i am using C in windows 7 and my complier is Bloodshed Dev C++

View 7 Replies View Related

C++ :: How To Compare Price Which Is Read From The File

Jul 6, 2014

I'm trying to compare prices which are read from the file along with other information. The input file is as shown below: The file data is something like this:

//Program to test the class listType
#include <iostream>
#include <fstream>

[Code]....

View 5 Replies View Related

C++ :: End Of File Found Before Braces

Dec 7, 2014

I have counted my braces and it look to be correct but I am seeing double.. I am getting the "end of file found before the left brace.. do I have one in an incorrect place?

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

int totalCaloriesBurned (double);

[Code] .....

View 6 Replies View Related

C++ :: Reading File Then Writing To It If Duplicate Not Found

Jan 22, 2014

I'm having issues with writing to a file. more precisely, i'm trying to determine if a set of numbers are in the file. if they are already in it, don't write to the file. if not, write to the file. My problem is my program is writing all numbers, even duplicates. The sort is working.

#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
//Counter Stats
int STR;

[code].....

View 9 Replies View Related

C/C++ :: Error C1075 - End Of File Found Before The Left Brace

Apr 30, 2014

Full error: error C1075: end of file found before the left brace '{' at 'ConsoleApplication1.cpp(9) was matched

Here is my code

#include "stdafx.h"
#include <iostream>
using namespace std;

[Code]....

View 4 Replies View Related

C :: Finding Unique Strings Within A File?

Aug 10, 2014

I have been trying to write this program that reads a file of courses and then stores only the unique courses in an array of strings.

for some reason it crashes while reading the 2nd line.

printf within the function are just for me trying to trace the problem.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char** uniqueCourses(FILE *fp, int *wordCount);
int main()

[code].....

View 5 Replies View Related

C Sharp :: Calculate Unique Metrics In A File

Feb 19, 2013

E.g. i have a log file in which there are many entries for appGUID. Now how many appGUID's are there, for this i have a code, but how many of them are unique, for this i don't have code.

View 4 Replies View Related

C++ :: Reading Date From File

Mar 21, 2014

So here's my file content:

J001 Graham Bell 145 20/03/2012 23/03/2012

my current code is.

#include<iostream>
#include<fstream>
#include<string>

[Code]....

I have 2 problems right here.

1) Why it could not load or read my file.When i run the codes.I was prompted with a blank cmd instead of "File could not be located.

2) How do I calculate how many days that a customer been staying inside the hotel?

For example:20/03/2012-23/03/2012

View 1 Replies View Related

C++ :: How To Delete Date On A Txt File

May 7, 2014

I'm doing a daily time record that record every inputed date on a txt file how will have an option or how will I delete a some of the choosen date? i'm using C++

View 1 Replies View Related

C++ :: Two Date Structures Sharing Same Date

Mar 28, 2014

I have two date/time structures which I'm populating, but when I populate the second one it sets the same values in the first. This is what I've got so far

tm *FirstDate = gmtime(&now);
tm *SecondDate = gmtime(&now);

cout <<"Enter your first date in the format dd/mm/yyyy" << endl <<">";
getline (cin,tempstring);

[Code] .....

View 2 Replies View Related

C++ :: Linked List - Friendship Of Functions Related To Classes

Jul 5, 2013

I'm developing a stack using a linked list. I have to develop two friend functions to do something with the list. But I've tried to understand the friendship, without any consistent result.

Extract of code:

Code:
class Element {
public:
int Data;
Element *nextElement;
Element(int Element) {Data = Element; nextElement = NULL;}
~Element() { }

[Code] ....

I have no errors, but I cannot access the private properties of the class.

The thing I would like to do is: sum the elements of the stack with a friend function.

View 7 Replies View Related

C++ :: Source Files Separation And Inter-related Classes

Feb 11, 2012

I have heard that people should implement their class member functions in files that are different from their class declaration files. But in cases there are multiple classes that are inter-related to each other, how will you review the source code ?

View 1 Replies View Related

C++ :: User Defined Function - String Related Program (swapping)

Jan 4, 2015

Write a program using user-defined function which is passed a string and that function should cycle the string.(Do not use any string related functions). E.g.

If the string is : Chetna then it should print as Chetna, hetnaC, etnaCh, tnaChe,naChet, aChetn

Ans.

#include <iostream>
using namespace std;
char swamp(char a[], int x) {
for(int k=0; k<=x; k++) {
char l= a[x]; a[x]= a[0]; char p=a[x-1]; a[x-1]=l;
for(int i=1; i<x-2; i++) {

[Code]...

View 19 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







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