C/C++ :: Read From Dat File And Produce Output On Screen - Error C2664
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
ADVERTISEMENT
Jan 26, 2013
Write a program to read in a sequence of examination mark from a text file named as input.txt and produce the mean, and standard deviation of the marks. Your program should also produce a bar chart for each grade where the range of mark is given as below.
GradeMarks Range
A80-100
B70-79.9
C50-69.9
D40-49.9
F0-39.9
Output the result to another text file named as output.txt.
View 3 Replies
View Related
Nov 9, 2013
Working on a basic class program and I'm generating two compiler errors that I'm not sure how to fix. Header file, implementation cpp and main cpp are shown below. The specific errors are shown after the code.
Header file Code:
#include <iostream>
#include <string>
#include <cstdlib>
#include <iomanip>
using namespace std;
[Code].......
The file generates the second error, C2228, at lines 37-41 and 43. Basically where I tried using the second created object. Error message is "left of '.setFirstName' must have class/struct/union"
View 8 Replies
View Related
Jun 8, 2013
I've been trying to work fix this piece of code to put into a project but I could not get it to work. I keep getting this error C2664: 'SumOfNumbers' : cannot convert parameter 1 from 'int' to 'double []' . I've worked every thing piece by piece but when I try to pass the array to the function I get the error and don't know what it means. Does C++ not allow what I'm trying to do?
Code:
#include <iostream>
using namespace std;
void SumOfNumbers(double Nbr[], int size);
int main()
[Code] ....
View 7 Replies
View Related
Apr 24, 2013
Why the two shown func args are different?
struct MyFileClass {
.....other code
void MyFileOut( TCHAR* pS, DWORD pVar) {
TCHAR PrntStrg1[] = _T("The value of passed ptr->");
[Code] ....
View 7 Replies
View Related
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
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
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
Mar 25, 2013
I have code that reads an input file and generates an output file .For reading the input file we have a xml file.If there is an error while reading or writing the output file the an errored file is generated. But in the errrored file the fields are not coming as in accordance with the reader xml . They are coming randomly . In the module for reading and writing the errored file list is being used . What should be done to write in the errored file as the reader xml fields.
View 1 Replies
View Related
Mar 25, 2013
I have code that reads an input file and generates an output file .For reading the input file we have a xml file.If there is an error while reading or writing the output file the an errored file is generated. But in the errrored file the fields are not coming as in accordance with the reader xml .they are coming randomly . In the module for reading and writing the errored file list is being used . What should be done to write in the errored file as the reader xml fields.
View 1 Replies
View Related
Apr 7, 2014
I'm supposed to read a text file and display it in the output. I have it down except my formatting. I just cannot get it to just skip one line rather than multiple. I know why though because my char has a max of 11 and if I put a character lets say mango, it is going to fill in the rest with white spaces. It's supposed to display like this:
Mango
Strawberry
Grapes
But instead I get something like this
Mango
Melon
Grapes
I am using isspace but it's not working.
//source code
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <fstream>
using namespace std;
class CFile
[Code] ....
View 5 Replies
View Related
Apr 20, 2014
I know this is how you read from a file. I also want to print my output to the same name of the file plus ".txt". So if my file is called "text" I want to print it to a file called "text.txt".
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
[Code]....
Would it be something like this? Is it better to use "a" or "w" in the fopen? I want to write to it several times.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
[Code].....
View 2 Replies
View Related
Jan 13, 2013
I have a file named "A6.txt" inside it has this code:
April Joe, 1, SUPER DUPER ULTRA SECRET, 02031982|
Matthews Jocob, 2, TOP SECRET, 11031992|
Garfield Kitty, 3, SECRET, 04041942|
Lake Bill, 4, MEH, 12031968|
Jones Betty, 5, WATCHLIST, 06031974|
Goodman Betty, 6, BANE OF SOCIETY, 05021952|
Very Simple, all it has is "Name, ID, Access, Date of Birth" (DOB needs to be formatted like 00/00/0000 if possible)
Output should Look like :
Client #1:
Name: April Joe
Access: SUPER DUPER ULTRA SECRET
DoB: 02/03/1982
View 4 Replies
View Related
Apr 19, 2015
So far I have managed to sort songs by their string length in main. The void function is there because i learned how to create it, but it's not being used because I dont know how to use it.
Expanding on main, how would I go about selecting a random song from the array?
#include <fstream>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
struct Song {
string song;
[code]....
View 2 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
Nov 18, 2014
Here is what i have so far:
#include<fstream>
#include<iostream>
#include<string>
[Code].....
I also need to do a loop that scan the count array and check if the element is bigger than the previous one.
View 1 Replies
View Related
Jan 31, 2014
I am trying to use struct to store variables from a text file and use them in the main program. I have first tried running the program without using struct and declaring the variables within the main program and it runs fine. But after using struct, it gives no compilation error and a segmentation fault as output. Also, if the size of file/variable size is unknown can I declare variables as char string[]??
The code is as below:
Code:
#include<stdio.h>
struct test {
char string1[10000];
[Code].....
View 4 Replies
View Related
Sep 27, 2014
called object 'fptr_in' is not a function or function pointer
called object 'fptr_out' is not a function or function pointer
what can i do for the errors?(i mustn't use loop and arrays for the code)
Code:
#include <stdio.h>
void sum_of_2nd_and_3nd( FILE* fptr_in, FILE* fptr_out);
int main()
return 0;
}
void sum_of_2nd_and_3nd( FILE* fptr_in, FILE* fptr_out){
}
[code].....
View 2 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
Feb 21, 2014
I have program that is supposed to read in a story from an input file and separate the words and output the lines on which the word occurs. It needs to read in another input file that has a list of words (1 per line) to ignore. i.e. skip them when running through the story. This is what I have so far, I've changed multiple things trying to get it running....
#include<iostream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<string>
#include"split.h"
[Code] .....
View 1 Replies
View Related
May 8, 2015
I am currently writing a password generator in Microsoft Visual Studios 2010 Professional. The section I am having a problem with is the practical password. It is suppose to randomly read 3 words from a text file and then display it in the text box. The program will compile and run but when I hit generate I get "True True True" and not three random words. Then this warning shows up:
Warning C4800: 'char *' : forcing value to bool 'true' or 'false' (performance warning)
//Code is from the form1.h file. I can post the rest of the code if need be but I just included my includes and the problematic section
Code:
#pragma once
#include <cstdlib>
#include <ctime>
#include <stdlib.h>
#include <cmath>
#include <iostream>
#include <iomanip>
[Code] ....
Screenshot of the warnings: [URL] .....
Picture of the output: [URL] ....
View 3 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