I have been given a task to make a c++ program that promptsd the user to enter a mp3 file name, read the ID3v1.1 tag and displays it. It then should prompt the user to to decide if they want to edit the comments section of it, then if they edit the section, it should re-print the updated ID3 tag. The list of genres are in a cstring that is as follows.
Program background: Ticket Sales Details You will sell tickets in advance and at the door. Prices for buying in advance and at the door will be given. Also, the total number of tickets sold in advance will be given. Each guest will have a unique number. If there are n tickets sold in advance, then these guests will be numbered 0 through n-1. As the event starts, requests to buy tickets at the door may be made and these guests will be numbered sequentially, starting at the lowest unassigned number. The maximum number of guests will be 1000. The first line of the file contains the following three values, separated by spaces: Cost of the presales tickets (in dollars), Cost of the tickets at the door (in dollars), and the number of presale tickets. The first two values will be positive real numbers to two decimal places and the last will be a positive integer.
The second line of the file will contain one positive integer representing the number of auction items followed by a positive real value to two decimal places (at most) representing the minimum bid increment, in dollars. The first value is guaranteed to be 1000 or less and the second will be in between 1 and 50, inclusive.
The third line of the file will contain all the prices of the auction items, in dollars, separated by spaces, in order. Thus, the first price is the price of item 0, the next price is the price of item 1, and so on. These values will be real numbers represented to up to 2 decimal places.
The fourth line of the file will contain the three following positive integers pertaining to the raffle: the number of raffle tickets available, the cost of a raffle ticket in dollars, and the number of raffle prizes. (It's strange to have raffle tickets that don't cost a whole number of dollars.)
The fifth line of the file will contain each of the values of the raffle items, in dollars, separated by spaces, in order. Thus, the first price is the price if item 0, the next price is the price of item 1, and so on. These values will be real numbers with upto 2 decimal places.
The sixth line of the file will contain ten positive integers representing the number of each of the drinks 0 through 9, in order, that are in stock.
The seventh line of the file will contain ten positive real numbers with upto 2 decimal places representing the price of each of the drinks 0 through 9, in order.
The eighth line of the file will contain a single positive integer, numEvents, representing the number of events that occur at the charity ball. These events are split into two groups: actions by guests at the ball and awards given (raffle, auction, person, totalrevenue). All of the actions precede all of the awards. You will produce exactly one line of output for each event described. Here are the formats of each event that could occur:
If a patron buys a ticket at the door, a command will be on a line by itself:
BUY TICKET k
where k is a positive integer indicating the number of tickets bought at the door. These guests will be numbered as previously mentioned. You are guaranteed that the total number of tickets bought, including presales, will not exceed 1000. This is what I have so far and I cannot figure out why it wont calculate the total revenue. I am not completely sure if it is even accessing the if statement in main.
Code:
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 1000
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.
I am trying to write a program that will open a file with 2 points, take those points, determine what quadrant those points are in, and save the result back into the same file without truncating the data.
I'm having some trouble with my file I/O. I can't get my program to read the two values for X and Y that I put in the points.txt file. It simply uses whatever random number was used last time in that block of memory. In my points.txt file I put something like "4 -5" and it wont assign those numbers to my X and Y variables. I believe the issue is on line 25
#include <iostream> #include <fstream> using namespace std ; int main() { //defining X and Y double X, Y ;
If I am reading data from a .txt file with a person's last name and first name (e.g. Miller Andrew), How do I output the same data with the first name followed by the last ?(e.g. Andrew Miller) Do I use the ignore function?
I want to know how to read a .pgm file from my hdd and store it in a 2d array so i can perform some action on the array later on. This is ny first time working with an imqge in c so i know nothing about it. .
The actual code is a bit longer since it offers you to input the size and then it draws the pic. Now that wasn't so hard and I've done that but now I wanted to implement the "MessageBox" func for output.
I managed to write the cube in file cube.txt but when I'm reading from it 1 char at a time since I need to output as char array it avoids all spaces and new lines and just puts all symbols in the same row.
I didn't have that issue with C and I've found on stackoverlow a solution using strings & getline but I need it to be in "char" form.
How to actually read spaces and newlines? This is my current code for reading from file:
Code: ifstream di("kocka.txt", ios_base::in); char c[5000]; int br=0; while( di >> c[br]) { br++; } MessageBox(NULL, c, "Kocka", MB_ICONHAND); di.close(); P.S kocka = cube (in croatian )
I'm writing a program using Huffman algorithm to compress text file. I have tested my program by just printing the printing ASCII character to file and it worked fine. However, now I have to implement using bits and my program doesn't work. It seems like I'm not reading or writing the right bits. Here is the result of my testing:In the input file I put abc the input file to compress it. Then I uncompress it the out out is aaa. Below is a snippet of how I read and write bits
Code: class BitInput { istream& in; // the istream to delegate to char buf; // the buffer of bits int nbits; public:
It appears that when you enter command line arguments or use fgets() to input a string you can assign that string to another string variable using the assignment operator. But when you read from a file, you can't do that, you get a segfault. It seems the only way to get around that is to malloc the string and use the strcpy function.
Code: #include <stdio.h> struct person { char *names[2]; }; void readFile(struct person p){ FILE *file = fopen("names", "r");
I made a txt file which contains a necessary information into my project file and tried to read and print it. However, seems like my program is not reading my file at allI named my file as student
I have a text file containing 500 signed decimal numbers. My task is to read each entry and convert into a 16-bit 2's complement representation (binary number) and write into the another text file.
extracting records from a text file based on the user input of a specific date. Below is a image of the Text file with Dates and records that follow. a code to extract records from file based on the day the user enters with month and year not necessary here.so it is based on the day the user enters, which the code will extract the records and if day is not found then "DATE NOT FOUND"
if i start reading individual characters from a text file having the following content: "music, Indian classical dance, and other aspects of Indian culture.It is also a movement with chapters in over 200 towns and" what are the characters that will be read after the word 'culture.' ?
I'm writing a code which has to read a text from a file. In this text, there are some symbol and numbers (ex, This is $19 of....). Those symbols and numbers should be replaced with the words from the other file. i.e.
transformed file
This is just an $19 of what the $5 should obtain.
And $19 should be replaced from association file
19 example 5 program
The result:
This is just example of what the program should obtain. I'd like to save the first file content into an array of strings and the same for the text of second file.
I'm working on a homework project, and it requires me to read in a file of chars into an array, and then do stuff with that array.
Anyways, I have the first part written, where I'm just trying to read in my data.txt file, and I thought I had it written well. It compiles, but then it seg faults, and I'm not sure why. I used calloc for the array, but maybe I misused it? Or is it in my EOF statement? I'm still not sure if that's coded correctly. I need to get past this so I can start testing the other parts of my code.
Code: #include <stdio.h> #include <stdlib.h>
int main(int argc, char* argv[] ) { /* Local Declarations*/ int i; int *ptr; char tempc;
So if I have a file that has a list of scores and the name of the student, how am I going to read the scores and names, and print to output? For example, the text file will look like:
83 75 89 90 75 67 John Doe 67 92 78 64 88 95 Jane Waters 76 65 87 70 97 76 Billy Bob
And they'll be printed like that too.
I made a 2D array for the scores and names, and was able to scan the scores into the scoreArray, but I am stuck for the names. Do I use fscanf, fgets, etc? And how do I use these for a char array?
insert Code: int main { int scoreArray[NUM_ROW][NUM_COLUMN]; char nameArray[NUM_ROW][SIZE]; ...........opened file, etc.
[ for (row=0; row<2; row++) { if(row>0) {printf("
[Code] ....
When I run this, I get the scores and names (somewhat) in a jumbled mess.....
The problem is that ... Even though it is reading from a a file, it is not reading a one struct. In this piece of code I'm trying to read the last struct, which should be k... The struct itself is here
I'm trying to make a basic settings text file and I'm wondering why pos_y = strAxisData.find(",", pos_x, strAxisData.length()); returns std::string::npos when pos_y = strAxisData.find(","); works fine ? The settings text file format is:
I got an assignment to do...and in that i need to get the inputs from a .txt file....and im not getting how to read the data i want and skip the rest thrash.