I dont know anything about filestreams. I want to record the files that the customer bought, total, cash and change.
Here's my code.
// Create a program that will initiate a purchasing system for registered agents in an agency. #include<iostream> #include<windows.h> #include<conio.h> #include<fstream> #include<string> using namespace std; void password();
I am creating a student management system (using classes) for my assignment and am stuck with designing UI. I made the classes but am not sure what the best control is to display items from a Dictionary<> object. Right now I am using the ListView because of the columns in details view...just want to know if there is a better, simpler control I could use if i want to display data (without using sql)...or is the good old "next" and "previous" option the simplest?
I'm trying to use a listview component to show all the fonts on my system, and display each item (row) in the actual font design.
When I run the following code, nothing displays in the listview.
If I rem out line 4, then the list populates with all the fonts, but of course, in the default listview font.
I thought I read somewhere that each item in a listview can be set to a different font.
int i = 0; foreach (FontFamily oneFontFamily in FontFamily.Families) { listView1.Items[i].Font = new Font(oneFontFamily, 10); listView1.Items.Add(oneFontFamily.Name); i++; }
I am having trouble with string statements in general. But the biggest problem I have is that my assignment requires that I make a grocery list with a function that uses string statements. I have all the variables and functions other than the string working. But i need a basic outline on the receipt. NO specifics! I just need a basic outline more than our teacher has given us. Also I have searched for other programs using receipts but they used vectors and my class is not into that yet how vectors work yet so I am avoiding using them.
im new to programming and new to C, just started with arrays and im somewhat stucked, where i have a .txt file which contains items and prices. I want the items and the prices split into 2 different arrays
The .txt looks like that:
orange 0.89 banana 0.79 apple 0.59
I now want to split the items in a char items[100][100] and float prices[100]. how to split this, preferably with fscanf ?
I am working on pset4 in the CS50 online coarse. The goal is to resize a bmp image. I have it working except adding the padding back to new resized image. The image I am using uses 3 bites of padding. If the factor I resize the image by works out to have 3 bites of padding it works perfect and if the image has no padding it works perfectly I need a fresh pair of eyes. I am not sure how to add the images so here is the address to download the images and the skelton of the source code they gave to modify. [URL] .... The image that requires the padding is labled as small.bmp.
#include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char* argv[]) { // ensure proper usage if (argc != 4)
Write a program that is able to save a list of items such as books, CDs, or DVDs and the items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.I would like to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.I have this for a start of how to set up a storing program.
#include <iostream> #include <iomanip> using namespace std; int main () { const int arraySize = 10; int a[arraySize] = { 2, 6, 4, 10, 12, 89, 68, 45, 37 }; int i, hold;
The following piece of code is supposed to output the binary representation of a given integer and it does exactly that. However, if the given integer is 2, then output is 01. Is there a way to make the program output 0001. I am working on a C program that outputs 4-bit gray code.
#include <stdio.h> #include <math.h> int main(void) { long int n=2; while (n) { if (n & 1) printf("1");
I am using atomic instructions on x64 and variables so used must be 16 byte aligned.
I use a number of structures where their members are so operated upon.
The structures accordingly needs must be 16 byte aligned and padded - their internal members must be on 16 byte boundaries and, crucially, there must be tail padding to a 16 byte boundary, so I can allocate arrays of these structures and use pointer math to iterate. (I am naturally using aligned malloc).
The problem I am finding is that it is not apparent to me how to achieve this end. Here below we have a test structure (currently I'm working with the latest Amazon Linux GCC, 4.6.3, on x64);
The problem manifest is that sizeof(struct test_element) is 40 bytes! So the second element does not begin on a 16 byte boundary and we all fall down. Printing the addresses of the first element in the test element array, I see the following;
So we see fe->next is the first element and so is correctly aligned curtsey of aligned malloc, where fe->next is 16 bytes, fe->user_data is correctly aligned, but then te->thread_number is misaligned and te->datum is given eight bytes rather than four, leaving us in the end without correct tail padding to a 16 byte boundary.
So, what gives? how *am* I supposed to indicate to the compiler it must pad structures to 16 byte boundaries?
I'm trying to display data from a text file named ace_data.txt. Here's a preview of the first three lines i want to display:
2001 106 15 2002 65 12 2003 175 16
So basically, here is what my code looks like...
Code: #define FILENAME "ace_data.txt" int main (void) { FILE *inp, *outp;
[Code] ....
And nothing is displayed when i run the program. I feel like I made some mistake with the fopen() and fscanf() functions but I'm not so sure how to correct them.
How can i display a string per line on the .txt i made? There are 2 .txt files, the one has: John Finn Xach The other is: password1 password2 password3 Question is: How can i display, let's say, i input "John" so it will display something like this "John's password is password1" or if i input Xach, "Xach's password is password3" When i use something like :
how to read and display the content of a text file in my console application using C++. The file contains 25 lines and 3 columns. The first column is "Rank" (numerical values from 1 to 25) the second column is "Name" (25 teams name) and the third column "value" has the amount of point each team is worth. Looking for code for reading and displaying all this information ....
Write a program that reads from total.dat file and displays its contents to the console. The program should allow the user to add new entries to the file.
So far this is what I've got and I'm not sure if I even started right.
#include <iostream> #include <fstream> using namespace std; int main () { ifstream dataIn; ofstream dataOut; dataIn.open("total.dat"); cout << dataIn; return 0; }
I am currently doing a complex number calculator ,and i wish to output my data to a txt.file . i tried fstream and it doesnt work. However the txt.file was created but no text was output.
Below is the program:
#include<iomanip> #include<cmath> #include<iostream> #include<fstream> using namespace std; #define PI 3.14159265358979323 double z,x;
[Code]..
When impedance A & B are in series,the effective Impedance is " <<setprecision(4)<< z << " + j" <<setprecision(3)<< x<<endl;
else cout << "
When impedance A & B are in series,the effective Impedance is " <<setprecision(4)<<z << " - j" <<setprecision(3)<< x*(-1)<<endl; } void Complex::showdiv(double &z,double &x) { if ( x>= 0 ) cout << "
When impedance A & B are in parallel,the effective Impedance is " <<setprecision(4)<< z << " + j" <<setprecision(3)<< x <<endl; else cout << "
When impedance A & B are in parallel,the effective Impedance is " <<setprecision(4)<<z << " - j" <<setprecision(3)<< x*(-1) <<endl; }
class Polar:public Complex //inheritant from class Complex { protected: double r,d,r2,d2; public: void PolarValue(); void ShowPolar();
I have learnt about string class, file I/O and pointers. Now I am asked to write a program that includes the above topics, basically testing the ability to use dynamic arrays.
I've got 2 documents, namely "Students.txt" and "EnrollRecords.txt". "Students.txt" includes 40 students' info, which are university ID, programme names and their names. These 40 students are all BEng but from different departments.
E.g. 20141129 BEng(Civil) Tom Jerry
"EnrollRecords.txt" includes 166 data, which are course codes, university ID, respective scores in the test and GPA. In this document, the same student can have several scores of different courses' tests. So their uids repeat in it. And this document only contains the data of the Department of Computer Science. So students exist in the "Students.txt" may not exist in this document.
So my task is that the user enter a name (e.g. John), then the programme will know to find John and his uid, and get all the GPA of the courses that he has taken to calculate the average GPA.
E.g. 20147777 BEng(CompSc) John David //this is a John we are looking for in the "Students.txt"
//line 15 COMP1220 20147777 90 4 //so we find 3 courses in "ErollRecords.txt" that John has taken //line 50 COMP1500 20147777 85 3.3 //line 88 ENGG2012 2014777 70 2.3
The programme should display :
20147777 3.2
To able to do anything for this task, I am asked to define 4 struct types:
struct Student { int uid; string programme; string name;
[Code] ....
So now I am going to write a function queryD(Database d, string searchName) and any necessary functions in it. I am able to do the search part,
void queryD(Database d, string searchName) { for (int i = 0; i < d.numberOfStudents; i++) { if (d.students[i].name.substr(0, searchName.length()) == searchName) { match_uid(d);
[Code] ....
But I struggle in how to match the uid in "Students.txt" and "EnrollRecords.txt" . Because there are repeated data for the same student in "ErollRecords.txt". So how am I gonna be able to match the uid and do the calculation? I get stuck in the for loop part...
get my code to display a table with values from a file. my current code fills up all the sections of the table with the same data. here is what I need: from a file .txt I upload numbers that should show a table like this :
Lake Beach Average E-Coli Level Recommendation Ontario Kew Beach 47.12 OPEN Huron Goderich 51.13 CLOSED Simcoe Sibbald Point 0 INSUFFICIENT
my problem is in the last two columns. The ave. E-coli has one value for all which should look like the above table but my code doesn't. Also my recommendation shows the beach # instead of open close or insufficient.the data is: