C :: Program That Saves Information On Memory
Jun 25, 2014
I am doing a program that saves information on the memory and then i need to put by ascending order the student number.. but i can't get it to work...i tried with strcmp but not worked...
Code:
typedef struct {
char name[100], email[100], adress[100], postal[100], number[20];
int phone
}data; t
Then i have this to input data
Code:
void add(data* contact) {
if (i<total) {
printf("
Name: ", i + 1);
fflush(stdin);
[Code] ....
View 13 Replies
ADVERTISEMENT
Apr 14, 2013
I'm working on a program which creates data and saves it into blocks (different files), then reloads and converts it all. the .ftl file saves properly, but for some unknown reason, it won't let me open it for input after.
Here's the significant code:
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
stringstream filename;
stringstream newfilename;
string Filename;
[Code] ....
setblock will typically = 3, but for testing purposes is set to 1. this really has me confused. the compiler i'm using is Dev-C++ 5.2.0.1 on xp. i have tried pausing the program after the output file is closed, confirming the file has been created in the proper directory before continuing but still fails the .is_open() check.
View 4 Replies
View Related
May 6, 2013
my program wont output any information to the text file that I have specified it just creates it but it leaves it blank
#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;
class Carloan
[code]....
View 2 Replies
View Related
Jul 2, 2014
I wrote a program to grade T or F test. It is running, but not outputting the information.
Code:
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
using namespace std;
double grading(char*answer, char* stuResponse, double graded);
[Code] ...
text doc:
TFFTFFTTTTFFTFTFTFTT
ABC5403 TFTFTFTT TFTFTFFTTFT
ABC5404 TFTFFTTFFTFFFTTTFTFT
View 5 Replies
View Related
Apr 30, 2014
I am creating a WinForm registration application and my program accepts user input information and stores it but I am struggling to use my login function. I believe there is an error in the area of cmd.Parameters.AddWithValue section, I dont think addwithvalue is correct ? I get a fatal crash has occurred when I click Login
string constring = "datasource=127.0.0.1;port=3306;username=root;password=welcome";
string Query = "SELECT * FROM 'userinfo'.'users' where 'username' = @userid and 'password' = @password)";
MySqlConnection conDatabase = new MySqlConnection(constring);
MySqlCommand cmd = new MySqlCommand(Query, conDatabase);
cmd.Parameters.AddWithValue("@userid", this.userid_txt.Text);
cmd.Parameters.AddWithValue("@passone", this.passone_txt.Text);
[code]....
Fixed the crash error, simple typo but now I am getting SQL Syntax errors which I originally believed I fixed.
View 1 Replies
View Related
Jan 30, 2015
i want to display the grade report of two students in the table but this code will repeat the grade report of one student in the tables and what is wrong with this code below ?
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
[Code]....
View 3 Replies
View Related
Jan 3, 2015
I am working on binary files in turbo c++ 3.5 and i want to create a library program. I want to add information about books in a binary file and do functions such as: Search and replace, delete a record, and etc.
I do this functions but i have 2 problems: 1. For example when i add 6 records about books to file, BooksReport function cant show all records and for example just show 4 or 5 records and when i search records, from 5 records, for example i just found 3 or 2 records. 2.When i search and replace a word on file, all records thats before this edited record, will be deleted.
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void add();
void search();
struct {
char name[20];
[Code]...
View 2 Replies
View Related
Mar 10, 2014
I am writing a program that grabs information from a .dat file. I have the code all structured up, but I get these 2 errors that does not make any sense to me on how to fix the program.
errors (2):
Code:
Error1error LNK2019: unresolved external symbol "void __cdecl swap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> > *)"
[Code] ....
Error2error LNK1120: 1 unresolved externalsC:UsersMomDesktopDriveQuarter 2C++ProjectsDynamicDeptPayrollDebugDynamicDeptPayroll.exeDynamicDeptPayroll
.dat file contents:
Code:
Fogarty Bob 1 40 10.25
Smith John 2 38 8.72
Jones Mary 2 28 6.25
Arrmen William 1 15 8.22
Lavey Betty 1 32 15.00
source contents:
Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
//PROTOTYPES
void sort(int n);
void swap(string *p1, string *p2);
[Code] ....
View 2 Replies
View Related
Jan 10, 2014
How can I send information and receive from external command prompt from my program??. I want to run an external command prompt, a code that's is not mine, to send information to this command prompt, then make my program hit enter at the command prompt and then receive back information from the command prompt.
View 5 Replies
View Related
Dec 12, 2013
Here your supposed to create a program that takes in information and formats it into three columns.
I can't seem to use the float variable unitprice with decimal places here for, if I try to use %.1f and type in an input, the program seems to skip over the second scanf function, not allowing me to put input into the third scanf function as the program runs before I can.
I can use %f on its own and it works but this creates too many zeroes(and you're supposed to set the currency limit to $99999.99).
Code:
#include <stdio.h>
int main(void) {
int itemno, month, year, day;
float unitprice;
[Code]....
So the output should look like three columns. It's just the float that is the issue here....
View 5 Replies
View Related
Aug 15, 2013
Code to accept the information of 5 students and display the information of first 3 students......
Code:
#include<stdio.h>
main() {
struct stud {
char name[20];
int rollno;
float per;
char grade;
[Code] ....
View 6 Replies
View Related
Apr 12, 2013
I'm very new to MFC & VisualC++. I'm using MSVS2010 Pro. I am trying to write/debug a simple form that saves and restores the content of some edit controls. It seems to work as expected, except the file saves only to the Project Folder, regardless of where I browse and select to save the file.
Code:
void CMFC_FileDialogDlg::OnBnClickedbtnsave() {
this->UpdateData();
CFile f;
//Kinda Correct, Works but still saves in Project Folder
BOOL b_OpenFileDialog = FALSE;//this doesn't act as bool in CFileDialog?
[Code] ....
My only experience is a little simple VB programming in Excel, so any specific examples??? Also, rules seem to change from version to version? I have to "update" a number of undocumented programs.
View 4 Replies
View Related
Nov 3, 2013
How do you store a variable in memory so that it isn't changed when the program closes? I don't have any experience with this and am just wondering how it is possible. I am creating a program and want it to store your preferences and scores. In a simple program, everything is just reset and I don't want this for my program. How do I store a variable so that it stays the same, but can be changed even when the program is turned off?
View 2 Replies
View Related
Jan 16, 2013
i want to write a program that can access to variables and methods of another program. I ques for access to variables need to read memory, but about methods?how i can use methods and call them?
View 1 Replies
View Related
Nov 22, 2013
How to free the memory and address,value
Server:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
[Code] .....
Client:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
[Code] .....
View 1 Replies
View Related
Mar 2, 2012
Write a C++ program that had a base class PLANT with a sub class of that of TREE. The Program works exactly to her specifications except there is a memory leak.
--Header Files --
Plant.h
Tree.h
--Resource Files--
plant.txt - For Input
tree.txt - For Input
plantReport.txt - Output of Program. No cout is really allowed by her.
--Source Files--
Plant.cpp - Code for plant.h class
Tree.cpp - Code for tree.h class
MainDriver.cpp - Contains int main()
View 14 Replies
View Related
Mar 28, 2013
I am working on a c program which recovers jpeg files from .raw file of a memory card. My code is here-
Code:
#include<stdio.h>
#include<stdlib.h>
int main(void) {
File* inptr=fopen("card.raw","r")
if(inptr==NULL)
[Code]...
But while compiling it I get this error-
Makefile:2: *** missing separator. Stop.
View 2 Replies
View Related
Sep 18, 2014
I'm searching a program that can detect a special type of memory leaks, like these:
int a = 12;
char c[10];
char cc = c[a];
View 8 Replies
View Related
Mar 21, 2014
I have an assignment that wants me to better understand how certain calls like malloc() and free() work. I'm supposed to have one function that allocates a pool of memory for the program to use (this is the only place where I'm allowed to use the malloc function. Anyplace else is off limits, except when allocating space for data structures.) Another function needs to be defined that allocates memory from this large pool of memory that we have already allocated. A third function needs to free a block of memory when a call from function main is made and a fourth does something else (haven't gotten that far yet.) I'm not sure if it's ok or not, but I'll attach the pdf form that describes all the requirements. If that's not ok, I'll delete it.)
Anyways, when thinking of data structures to use for this particular problem, one doesn't jump out at me as being THE data structure that would be most useful. How I would imagine using it is to store the addresses currently being used as well as the block length of those addresses (so basically, each node of the linkedlist would have a pointer that points to an allocated address and another field that told the size of the allocated block of memory.) How to communicate to the large pool of memory that a certain block of memory has been allocated and shouldn't be used until a free is made on that specific block of memory.
Attached File(s)
pa3.pdf (61.07K)
View 2 Replies
View Related
Jun 21, 2013
the question is; Write a program that prints out the memory addresses of each element in a two-dimensional array. Check to see if the values printed out make sense to you based on the way I explained it before.
Below is the code I have done. I am having problems printing the "-" sign to keep formatting with the board when the user enter in different dimensions other than [4][4].
Code:
#include <iostream>
using namespace std;
void printTable (int x, int y) {
int **p_p_twoDimension = new int* [y];
for (int i = 0; i < y; i++) {
p_p_twoDimension[i] = new int [x];}
[Code]...
View 12 Replies
View Related
Dec 4, 2013
I have a program that stores health information the user inputs, one person at a time. The program works perfectly with the exception of storing the data...I need to open a file and read what health data it has in it already, if any, but store the new changes, and appended data to the array of structures, to the data in memory. All of the information is only saved back in the file once the program terminates. I'm not sure how to go about doing this, so I am also not sure what to put in the function for "Save and Exit" that the user can choose in order to exit the program.
Code:
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
struct strdatabase
{
char first[20];
char last[20];
char gender[2];
[Code]...
I tried playing around with this bit of code, but I'm not sure if I'm even on the right track.
Code:
FILE *fp;
fp = fopen ("students.txt","rb"); fseek(fp, 0, SEEK_END);
long pos = ftell(fp);
fseek(fp, 0, SEEK_SET);
char *bytes = malloc(pos);
fread(bytes, pos, 1, fp);
fclose(fp);
View 9 Replies
View Related
Jan 26, 2013
I have a program which call only one time malloc at the start of the program. When running, I see with 'process-explorer.exe' that memory is growing in little steps. Is this normal? why?
Using Windows 7
View 5 Replies
View Related
Sep 19, 2013
I got an assignment at school asking for a program that can implement functions that store, get and deletes text/binary data to a given memory area. We are supposed to make kind of like a tiny-mini OS..any links to some tutorials or explanations hon ow to understand this and be able to make a program like this on my own?
View 9 Replies
View Related
Nov 6, 2014
I developing a C++ Program to deal with huge data computation. I am using Pointers to hold the data during computation. Current program i developed without using CLASS.
I would like to ask that will the memory usage will be reduced and computational time will be shortened if I modified my program implementing the CLASS into it ?
View 1 Replies
View Related
May 21, 2014
The problem is when i run this program and program is stop working but the output is out.
#include <iostream>
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <conio.h>
using namespace std;
void EnumeratePrinters(DWORD flags);
[Code] ....
View 6 Replies
View Related
Sep 9, 2013
I am building a program that will read from a particular web page. I have written it so that it will parse the page correctly, but I can only do it for a downloaded page right now. I would like for it to work simply with the URL.
I have seen things about "screen scraping", though I don't quite understand what it does - I think it's more for just parsing it, which I can already do.
If it is possible to automatically download that file, that is fine as well.
If it matters at all, the pages I am reading from are stories on Fanfiction.net.
View 1 Replies
View Related