C++ :: Banking System - Searching For And Printing Values From TXT File

Mar 21, 2013

So I'm doing a kind of banking system. Atm I've got the user able to create an account and set the balance of it, which is written to a .txt file. However, I would like the user to be able to enter their account no. and the program to cout the account info on the screen. I will be adding more to the program later, but until I work out how to search for values in a .txt file, and print out values on that line I'm a bit stuck.

Code:
Main.cpp -
#include <iostream>
#include "create_account.h"
#include <fstream>
using namespace std;
int menuin;
int main() {
create_account creataccObj;

[Code] .....

Sample .txt file -

// Account_no - Balance //

1001 140500
1002 150600
1003 18600

View 8 Replies


ADVERTISEMENT

C :: Banking System - ATM Program

Mar 27, 2014

I am working on a project that is like a banking system and needs to include making a withdrawal, transaction, deposit, query, and transaction.

Code:
#include <stdio.h>
//#define true
//#define false
//assume there is money in the account. $10,000
void deposit(){

[Code] ....

View 1 Replies View Related

C++ :: Customer Account Banking System Error With Variable Input

Sep 30, 2014

Im building a banking system. in my create_account it asks for account address and phone number as well as other questions. When I go to my Show account info (balance inquiry) I notice its not getting the right address as well as phone number. its showing "garbage".

Code:
/********************************************************************
* Vincent Dotts 09/29/2014 ch11.cpp *
* This program serves as a customer banking system *
*****************************HISTORY*********************************
* WHO DATE Discription *
*********************************************************************
* VD 09/30/2013 Created program *
********************************************************************/
#include<iostream>
#include<fstream>

[Code] .....

View 3 Replies View Related

C/C++ :: Reading Hex Values From File And Printing Them In Decimal

Dec 1, 2013

I am trying to read hex data from a file (not just hex values in text format). I was able to read it (02 EC) with "fread" into an char before but I need to change the Hex value into an integer in decimal.

I already read about strtol but I would prefer reading the hex Value into an integer.

Here is my code so far:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
int itrack1[1];
int itrack2[1];

[Code] ....

View 11 Replies View Related

C++ :: How To Program A Hash Map System Where Each Key Have Multiple Values Under Indexes

Nov 13, 2013

How difficult would it be to program a hash-map system where each "key" can have multiple values under indexes?

For example: "Word" -> 45(index 0) , 67(index 1) , 12(index 2). What could I start with to program this or where could I find a pre-made system that does this?

View 14 Replies View Related

C++ :: Printing Vector Values Preceded By

Apr 17, 2014

Why does this generate an error:

Code: std::copy( vec.begin( ) , vec.end( ) , std::ostream_iterator<double>( " " , std::cout ) ); whereas this works fine:
Code: std::copy( vec.begin( ) , vec.end( ) , std::ostream_iterator<double>( std::cout , " " ) ); I know I can use this instead:
Code: for ( std::vector<double>::iterator it1 = vec.begin( ); it1 != vec.end( ); ++it1 ) std::cout << " " << *it1;

View 5 Replies View Related

C :: Drawing A Box With Coordinates - Printing Between Certain ASCII Values

Sep 23, 2014

The assignment is:

1) Write a program that asks the user for a a single character and two XY coordinates. The two X and two Y values should all be integers between 0 and 50. The character should be a printable ASCII character with values between and including ' !' (ascii value 33) and '~' (ascii value 126).

2) Your program should then draw a rectangle made up of the user selected character where the upper left corner is at X1; Y 1 and the lower right corner is at X2; Y2. Be sure to print the appropriate number of blank lines (having spaces in the blank rows is OK) in the beginning and pad each row of your rectangle with X1 leading spaces.

The Output is supposed to be similar to this:

(X1,Y1) = (0,0) , (X2,Y2) = (4,4), the character = ^

^^^^
^^^^
^^^^
^^^^

What I am having trouble understanding is printing between certain ASCII values (ASCII has never been discussed in class).

Another thing I am having trouble with is the main part of the assignment. From what we are currently discussing is loops and the assignment is covering nested loops. My code looks similar to this:
Code:

#include <stdio.h>
int main (void) {
int X1, Y1, X2, Y2;
char cRec;
printf("Enter a character: ");
scanf("%c", &cRec);

[Code] .....

My thinking on the assignment is that you want the X1 coordinate to increase to the value of X2 (same for Y1 and Y2). Is this thinking wrong?

View 12 Replies View Related

C# :: Printing All Values Above The Diagonal Line In 2D Array

Apr 11, 2014

I need to print all the values in a square 2d array that are above the diagonal line. So if I have this 6x6 array for instance:

{0,0,0,0,0,0},
{1,1,1,1,1,1},
{2,2,2,2,2,2},
{3,3,3,3,3,3},
{4,4,4,4,4,4},
{5,5,5,5,5,5}

I'd have to print the elements in italics. I've tried this:

for (i = 1; i < a.GetLength(0); i++) {
for (j = i-1; j >=0; j--)
Console.Write("{0,-2}", a[i, j]);
Console.WriteLine();
}

with the array mentioned above but for some reason it keeps printing the elements BELOW the line, when I need it to print those above it. I know that for arrays we usually start loops with a value of 0 but seeing as there should be nothing to print at [0,0] I started the loop at 1.

View 2 Replies View Related

C++ :: Searching In CSV File?

Feb 6, 2013

My .csv file is like:

Bone,origin,deep/superficial,location, action.

with list of 38 bones.

This is my main.cpp:

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <cstdlib>
#include "Action.h"
#include "Action.cpp"

[Code] .....

For action, if user enters action, it will output the bones involved with that action.
For strengthening, if user enters location, it will output bones involved with that location.
For dagnostic, if user enters bone, it will output location of bone and whether bone is deep/superficial.

How I could search in csv file for these.

View 11 Replies View Related

C++ :: Build A Banking Simulation Program Around The BankAcct Class?

Sep 5, 2014

I'm supposed to build a banking simulation program around the BankAcct class, which provides the following service: create new account with unique account number (maximum 5 accounts created in a single test running); deposit/withdraw; print information of all existing account. I was running a test program with only 2 services first, namely creating new account and depositing, but the program just keep on crashing and I couldn't figure out why.

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

[Code].....

View 1 Replies View Related

C++ :: Searching / Reading CSV File

Jan 29, 2014

How do i search a csv file?. I have a table with 3 columns (Employee ID , salary ,grade ) If i will enter an Employee ID and it should return the salary and grade of that employee id.

View 2 Replies View Related

C++ :: Searching A Text File?

Apr 23, 2013

im trying to make a function that will take in a users ID and search a text file for that ID and if there is a match to print out the matched line and the following 3 lines that follow. so far i ahve the following code but i cant get that to work and i dont knwo how to do the rest.

//declaring a file variable
FILE *fpcust;
int line_num = 1;

[Code].....

View 3 Replies View Related

Visual C++ :: Searching File For String?

Nov 8, 2012

The program then asks the user for a search string, which may contain white space. The program should search the file for every occurrence of the search string. When the string is found, the line that contains it should be displayed in the following format

nnnnn:Line Contents

That is the line number of the line, 5 columns wide, right justified, followed by a colon, followed by the contents of the line.

And this is what I've got so far:

Code:
#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
int main(int argc, char *argv[]) {
ifstream inFile;
string fileName,

[code]....

But this doesn't work. It prints everything in the file, not just the lines where the string is found.

View 9 Replies View Related

Visual C++ :: Using INI File For Configuring App - System Could Not Find The File

Aug 23, 2013

I am trying to use ini file for configuring my app.

But GetPrivateProfileString is not working.

I am using Windows 7. I tried "Wow64DisableWow64FsRedirection" also.

Not only this-ATLPath::FileExists is also not working.It gives an error code 0x80070002 which means:

"system could not find the file"

View 14 Replies View Related

C/C++ :: Printing Partitions Of A Number Using Constraint On Number Of Values?

Apr 15, 2014

I'm taking a C++ computer science course right now, and one of the questions on my latest assignment is this:

"A partition of an integer n is a way of writing n as a sum of positive integers. For example, for n=7, a partition is 1+1+5. Write a program that finds all the partitions of an integer n using r integers. For example, all the partitions of n=7 using r=3 integers are 1+1+5, 1+2+4, 1+3+3, 2+2+3."

I've been struggling with this problem for a couple days now, and how to do it. I understand I need a recursive function to grab variables, and probably an array or vector to store them, but where to begin.

I've been reading documents on partition generating and the concept still eludes me, and any other questions on here or other programming sites using partitions don't seem to have a constraint on them.

View 2 Replies View Related

C :: Printing Contents Of A File - Prints One Extra Character Not Present In The File

Feb 12, 2013

I'm writing a program that stores records into a file and then these records can be printed out. A last name, first name, and score is stored to be exactly 36 characters long (using leading spaces to pad) making it easier to retrieve specific records. For example, three records stored in the file would like like this: (the underscores are simply to illustrate the distance, they are not in the file itself)

_______lastname_______firstname__90__________lname __________fname_100___________last___________first __60

When printed out, the names are formatted as follows:

lastname, firstname: 90
lname, fname: 100
last, first: 60

However, when I print them out this is what I get:

lastname, firstname: 90
lname, fname: 100$
last, first: 60H

For some reason, for any record after the first, an extra character is added to the end. These characters are not in the file, so I was thinking that the array for some reason wasn't being filled completely, (the array is initialized to size 36 and 36 characters are read from the file using fread) so it was printing out a random character assigned to the 36th array position. Except the character never changes, (always a $ for record 2, H for record 3, l for record 4 if i remember) and I've tried reducing the array size or the number of character read and it's the string that gets altered, the random character always remains. I figure the problem must be in the print_records function (appending seems to work no problem). Anyway here is my print records and appending records code.

Code: /*
- Prints a single record stored in the file pointed to by ifp.
*/
void print_record(FILE *ifp, int record) {

[Code]......

View 6 Replies View Related

C++ :: System Cannot Find The File Specified

Apr 4, 2013

I just purchased Visual C++ 2010 Ultimate, to start my coding experience. Whenever I try to debug, it gives me this error:

The system cannot find the file specified

It can't find the .exe file, I even Googled it, and tried a few things, without any luck.

View 2 Replies View Related

C/C++ :: System Cannot Find The File Specified

Jun 29, 2014

I can't debug anything and get an error whenever I try. Being able to release a program to run it works sometimes, but it's hit or miss. I've created a very simple program to show the problem. The error on the screen is a result of me trying to debug, but I actually received the same error when trying to release as well.

View 6 Replies View Related

C :: Assigning Values To Arrays / Printing Arrays

Jul 1, 2014

Using a for loop, construct two 100 element arrays, x and y, such that element i of x stores the value sin(2*pi*i/100)) and the corresponding element of y stores cos((2*pi*i/100)). Print the values stored in the elements of x and y as you calculate them.

I have attempted to solve it but I'm not sure why the value 0 is only being printed, maybe I haven't assigned sin(2i/100)) and cos((2i/100)) to the arrays properly?

Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main () {

[Code] .....

View 3 Replies View Related

C Sharp :: File Copy From One System To Another?

Jan 23, 2013

I am making an application that runs on Machine1 and the purpose of the application is to copy the files from Machine1 to Machine2. It works fine but i have to share the folder of the Machine2 where i copy the files.

Is it possible without sharing.

View 1 Replies View Related

C :: Student Record System / File Handling

Feb 25, 2013

Code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
}

[code]....

I dont know how to modify the previous record that i have done in the Add Student function. i searched from different sites and got this code for modifying a record in a text file. But, i cant figure it out why its not working.

View 2 Replies View Related

C++ :: Save Images In Database Or File System?

Aug 22, 2014

Which is best option to save images in database or file system, I am developing c++ server client app. I want to save the images in server using file system or database. I am confusing to choose which option?

View 5 Replies View Related

C/C++ :: Change Access To The Folder On File System?

Aug 27, 2014

I want to delete the folder from the file system, but I am getting error of access permission.

I want to change the permission of the folder so my program can delete it.

The problem I am facing on google search is I am getting results mostly for MFC code which is windows specific. However, I want to write a code in core C++ that works on all platforms like unix and windows.

View 12 Replies View Related

C++ :: Student Registration System - File Updating

Feb 14, 2012

I have been creating this program for a student registration system. For the file handling So far I can write in to a file , view all records, and search a single record. now i got the problem with updating details . my coding is as bellow ..

void file_update() {
int r;
struct student stu;
fstream stu_file;
cout <<"========Update Record======"<< endl;
stu_file.open("student.txt", ios::app );

[Code] ....

My problem is it won't update the record. it just adding a new record.

View 9 Replies View Related

C++ :: Reading File Then Printing Data Onto Other File

Nov 7, 2014

I am reading a file then printing the data onto the other file. It is working, however when I check to see if each variable is being properly set after reading the file a issue arises.

Example of the file being read

Code:
Vehicle PV50CAN passed camera 1 at 05:33:26.
Vehicle W867BRO passed camera 1 at 05:33:29.
Vehicle KQ63ARU passed camera 1 at 05:33:38.
Vehicle K954ITQ passed camera 1 at 05:33:40.
Vehicle V220MXB passed camera 1 at 05:33:42.

[Code] .....

View 14 Replies View Related

C Sharp :: File Based User And Password System?

Feb 14, 2013

i can't seem to get my program to save the Set.savv file and encrypt it and decrypt it when user logs back on to there virtual file on a CD and writing it to the disk its self and closing the session

View 8 Replies View Related







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