C++ :: Data File Output To Screen
Oct 13, 2013
I am having trouble outputting the file "output1.dat" to the screen. here is my code -
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
//Outputs a description of what this program does
void intro();
void sort_merge(ifstream& in_1, ifstream& in_2, ofstream& out_1 );
[Code] .....
View 2 Replies
ADVERTISEMENT
Feb 5, 2014
My professor wants me to write a program that will read from a dat file, and produce an output on the screen based on the file. I don't understand why I am getting this error. I suspect it has something to do with the number of characters I've told it to read.
#include<iostream>
#include<iomanip>
#include<fstream>
#include<assert.h>
#include<string>
using namespace std;
using namespace System;
struct TStudent {
string month[10];
[Code] .....
I noticed I had a 2 beside girl, after I removed it, it still didn't fix my problem.
View 8 Replies
View Related
Jul 26, 2014
I have a csv file (comma delimited text file really) and I have data ,about 6400 lines, and I need to read and display data from 1 line. At the bottom is sample data from my csv file.
I want to read onto the screen the 3rd item .. ie Test User 1 and the date and time at the end (the last 2 items).
I will enter in a number .. from which I will want to retrieve the appropriate record .. in this case I would enter in 514, 563 or 874 and get back the info for that record.
This is a DOS 16 bit application .. and I know that some of the data is in memory already but I am not sure how to tell .. or how to retrieve it.
I do have the ability to save the data to the file at any time .. so I can use that to ensure that the data is current in the text file before I retrieve the data from this 1 row.
I think that it may just be easier to get from the text file ? but I am not sure.
0000,7,0,"Test User 1",53c145cb,db,5,514,514,2014/07/12,10:27:23
0001,7,0,"Test User 2",53d7f,1903,10,563,563,2014/07/24,11:04:31
0002,7,0,"Test User 3",529c,5ffb03,0,874,874,2013/12/02,09:07:58
I am a database guy .. and I am just a bit lost when it comes to C programming as such.
View 9 Replies
View Related
Jun 4, 2013
I have written a C++ program I have multiple of CSV file used as input, which I open one at a time and close it after extracting data to a output file which is the only file.
I run getline(inFile,line);
outFile << line << endl;
I run this code, and only part of it is goes to the output file I got, also have spacing randomly to specific file and inconsistent
But when I slower the code, like system("Pause") in the loop, I can get extract what I want perfectly....
Is my program running to fast, why getline would be skipping part of what things I want?
View 11 Replies
View Related
Feb 11, 2014
I have turbo c++ on windows xp SP2.....whenever i compile my code in turbo c++ i am getting output outside the screen.....but when i used code::block....i get the correct output...fits to screen ...
View 7 Replies
View Related
Jun 25, 2014
why I can't output ounces on the screen in c#...here's the code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Chapter7Problem12
{
class Program
}
[code]....
View 6 Replies
View Related
Apr 18, 2013
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
int main()
[code]....
I do not know how to output on the screen, I believe that i have written it to the file correctly but i dont know how to output it.
View 1 Replies
View Related
Oct 29, 2013
I want to write a program that makes this output to appear on screen using for-loop :
0 0
1
2
3
4
5
1 0
1
2
3
4
5
2 0
1
2
3
4
5
3 0
1
2
3
4
5
I can't seem to make the correct logic/engine of this nested loop.
View 11 Replies
View Related
Feb 2, 2014
I managed to write successfully my code that I have been wanting to write for some years now, but I want to align the text that is displayed in the output screen but I haven't been able to. I've tried adding and taking away numbers from the identifiers but nothing.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#define ARRAYSIZE 2
#define FORMAT "First Name Pago1 Pago2 Pago3 Pago4 Total Net"
#define FORMATHEADER "Last Name "
[code].....
View 1 Replies
View Related
Feb 27, 2014
i need my code to stop outputting all the numbers throughout the steps it is going through i just need it to output the total
this is my input
M
C
C
C
L
I
V
and its output is
Your total is 1000
Your total is 1100
Your total is 1200
Your total is 1300
your total is 1350
Your total is 1351
i just need it to output the last number
// write a program to read a string of characters
// that represent a Roman numberal and then convert
// to Arabic form ( an integer
// input from data file
[Code].....
View 1 Replies
View Related
Nov 21, 2013
how to display an image on the output screen of c++ program.
I am using : Turbo c++(dos box) on win8
View 1 Replies
View Related
Apr 7, 2013
I am trying to output data from two sorted arrays into one file(which should also be sorted). The program works for most of the data, but after it reaches a certain record begins outputting garbage. I'm sure part of the problem is that I don't know what to include in my while loop that outputs to the file.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
[Code]....
View 4 Replies
View Related
Oct 22, 2014
I was recently introduced to the fstream header file. I want to know is their a easy way to print an output with append data in a .txt file.
And secondly I am also having an error with my header file. It says error: cannot open source file "fstring" when I hover my mouse over "#Include<fstring>".
View 7 Replies
View Related
May 26, 2013
How can I make the output print out to the screen in reverse?
Code: #include <iostream>
#include <iomanip>
using namespace std;
int getnum();
void Fibonacci(int n);
[Code].....
View 7 Replies
View Related
Sep 13, 2014
/* This is what I have so far what i am trying to do is to initialize the arrays at zero and output the board to the screen. Part of the problem is the user has the option of the board size. All this is suppose to do is to output the board to the screen. I am having problems understanding 2D Arrays.
*/
using namespace std;
int main() {
const int BOARD_MAX = 10; // Maxinum Board size.
const int BOARD_MIN = 3; // Minimum Board size.
array = [COL];
array [ROW];
[Code] ....
View 5 Replies
View Related
Apr 2, 2014
Whenever I run my program, It should be taking this string of information:
Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23
Raspberries 6 4.99 29.94
Oranges 5 2.79 13.95
Apples 3 3.85 11.55
From one file and outputting it to another, the finished product should look like:
Shampoo 10 8.75 87.50
Pen 3 2.50 7.50
Headphones 5 20.99 104.95
MacAir 1 879.23 879.23
cheapest item = Pen
most expensive item = MacAir
total cost = 1079.18
shopper = Mary Kay
Raspberries 6 4.99 29.94
Oranges 5 2.79 13.95
Apples 3 3.85 11.55
cheapest item = Oranges
most expensive item = Raspberries
total cost = 55.44
shopper = Winnie B. The Pooh
When I run my code however, it doesn't get past shampoo and will continue to add shampoo to the total cost infinitely. How can I change the code to produce the proper information?
CODE:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <float.h>
#include <sstream>
#include <string>
using namespace std;
ifstream input_file;
ofstream output_file;
[Code] ....
View 1 Replies
View Related
Sep 17, 2013
I created a C program that extracts some information from computer and displays it on screen. It is completed today and is going to be applied to startup programs of domain machines. It runs at logon and takes somewhat 5-10 seconds to finish execution. The output is shown on console screen & user can either close the window by clicking on 'x' or pressing 'Ctrl+c' during execution. How do i prevent both of these events?
Basically the most time consuming processes are
Code: popen("systeminfo","r");
popen("wmic qfe get installedon","r");
1st command is getting OS name,version and hotfixes installed.
2nd command gives me the date of updates installed.
I then filter out data & print required information only.
View 3 Replies
View Related
Jan 27, 2013
i am using c++v30.5 version i want red color text in in my output screen . i viewed various site but the result is 0 ,wat to do?
View 2 Replies
View Related
Sep 8, 2014
Write a program to enter data into a table and display on the screen in tabular form. I want to know where are the errors.
#include<iostream>
using namespace std;
int main() {
int table[3][4];
int r,c,i;
r=c=0;
while(r<=2)
[Code] .....
View 3 Replies
View Related
Oct 28, 2014
I am trying to write my files to another subfolder . Below is my program.
Code:
cat th6.c
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#define SIZE 8
#define NUMELM 8
[Code] ....
I observe my filename along with directory as text in the new file created in sublfolder. This is output.
[cporgs/apue/threads]: mkdir first
[cporgs/apue/threads]: ./a.out test.txt first
test.txt -- first/test.txt
dfdfdfdfdfdfdf-14
dfdfdfdfdfdfdf-14
in thread test.txt first
[cporgs/apue/threads]: cat first/test.txt
dfdfdfdfdfdfdffirst/test.txt
[cporgs/apue/threads]: cat test.txt
dfdfdfdfdfdfdf
I could not able to get from where this filename and folder is getting added.
View 4 Replies
View Related
Apr 4, 2013
How to open a file and just print what is in that file on the screen. I though maybe I had the directory wrong but putting G: or G: give me the same result. When I select 1 it just goes to the next line and doesn't print anything.
Code:
int getchoice(void)
{
int num;
int choice;
FILE* outputfile;
[Code] ....
View 12 Replies
View Related
Nov 22, 2013
The aim will show on the screen but does not show the contents of a file on the screen different shows.
Code:
#include <stdio.h>
#include <conio.h>
main() {
char filename[100];
double xx;
int ii, kk;
[Code] .....
View 12 Replies
View Related
Apr 1, 2013
I have a file with numbers and want to display it on the screen.
View 15 Replies
View Related
Feb 26, 2013
is there anyway to read an entire file and print in on screen? file consists of strings and integers!
View 7 Replies
View Related
Jan 19, 2014
I am working on a wage application with four options which are as follows:
Subtracts an amount from the shop bank account (The account is text file "shop"). You do not need to add the same amount to another account but you should record the transaction with a timestamp in a separate file. The application should prevent the account balance from becoming overdrawn.
List the five most recent transactions to the screen. If there haven’t yet been five transactions then list all of them.
Print the account name, number and current balance to the screen.
Exit the program.
I have completed 1,3 and 4 but I am completely stumped as to how to go about number 2.
#include <limits>
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <ctime>
#include <string>
int read_balance(void);
void write_balance(int balance);
[Code] .....
View 1 Replies
View Related
Apr 7, 2013
I have a text file where in each line is 3 words and 2 int type numbers. I'm doing search by word and I want to print out to the screen the whole line where that word was found (the words is repeated in some lines). My search looks like this:
Code:
#include<iostream>
#include<string>
#include<fstream>
#include<stdlib.h>
#include <vector>
using namespace std;
int main(){
vector <string> words;
string str, paieska;
[Code] .....
How to print line(s) where I found that word?
View 9 Replies
View Related