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.
I have a .txt file that contains, together with a few characters, columns of values that I want to save in different files like is written in the program (file 1, file2, file3 - a with x, b with y, c with z). The pattern of the source text file is like this:
Until now I could manage to split the files, but the output gives me only zeros. First the program count the number of lines of the read text file, then it should display the desired columns of double values in three other .txt files.I've got for the three .txt files columns like this:
I must count the number of occurrence of all numbers in array , i wrote a code but it does not work properly
#include <iostream> int main (){ int i,n,tmp,counter=0; std::cout<<"Enter the size of the array:"<<std::endl; std::cin>>n; int *Array=new int [n]; int *counterArray=new int [n];
Double values are stored in text file. 23.5 36.8 34.2 ... My teacher told me to read them character by character and then make words, like i have to read "2" "3" "." "5" and now have to make it or treat it as word and then using atoi(). I have to convert it into double. but i dont know how to do this....
I have a program I have to do that counts the number of words in a text file. I have tried the code on 2 computers now since my programming teacher told me the code was fine. Here is my code:
#include <iostream> #include <string> #include <fstream> using namespace std; int main() { ifstream infile; infile.open("tj.text" , ios::in);
4.1 Write a program that will count from 1 to 12 and print the count, and its square, for each count.
4.2 Write a program that counts from 1 to 12 and prints the count and its inversion to 5 decimal places for each count. This will require a floating point number.
4.3 Write a program that will count from 1 to 100 and print only those values between 32 and 39, one to a line. Use the incrementing operator for this program.
I'm supposed to write a program to read a text file and display the following:
a) alphabetic letters //finished with b) digits // finished with c) other characters that are not alphabetic letters and not digits //finished with d) total characters read
The bold part above confused me, by total characters, does it mean the alphabetic letters + other characters? how would I put that in my code?
Code: #include <stdio.h> int main (void) { int curCh; int countCh = 0;
I have to count the letters from a text file into an array so the first spot is the number of A's second spot number of B's and so on then take the array and sort it in decending order how could i do this without loosing track of where the numbers go so if there are more b's than a's they switch but how will i know where each letter has moved in the array after it has been sorted?
I want to count all the numbers in my text file (read.txt). Read text file consist of floating and integer number. Answer for the above file would be integer=2 and float =10.
#include <stdio.h> /* function that will identify if line is empty or not */ is_empty(char *buffer) { while(isspace(*buffer)) buffer++; if(*buffer==0x00) return 1;
Write a program to print a histogram of the lengths of words in its input. It is easy to draw the histogram with the bars horizontal; a vertical orientation is more challenging.
See [URL] ....
I'm trying to do this exercise from K&R on my own (with my own code), but I'm receiving a signal (Illegal instruction (Core dumped)) when the input is too large.
#include <stdio.h> #define MAXWORDLENGTH 10 int main(void) { int c; /* Character read */ long length[MAXWORDLENGTH + 1]; int reading_word = 0; int word_size = 0;
[Code] ....
Where the problem might be occurring. I tried debugging with GDB but found no useful information.
Program received signal SIGILL, Illegal instruction. 0x00007ffff7a3b76e in __libc_start_main (main=0x4005d4 <main>, argc=1, ubp_av=0x7fffffffe2a9, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe298) at libc-start.c:258 258libc-start.c: No such file or directory.
The program output is also wrong when tested with the code provided at the link given above.
I have an assigment to make program which deletes from sentence all words with character count which is equal to pair number , for example - [ I like C ] and the result of this program should be [I C] because the word like contains 4 characters which is pair and it should be removed.
So I started writing my program and I am stuck at this block of code -
#include <stdio.h> #include <stdlib.h> main () { char text[100], blank[100]; int c=0,d=0,i,j; gets(text);
[Code] ....
To explain what is happening - I go through all string and search for first ' ' space symbol and check its value. If it is pair then my program prints that it is not pair[because last character before space had not pair number of characters], but the hardest part comes in when i have two not pair words , because space takes one character and now when i check if i%2 == 1 the answer is false [0] for the second word .
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.
Repeat the vowel Problem 3 (0 / 0)Write a program that will repeat k times each single occurrence of a vowel in the input file "sp.txt" to a new file "output.txt". The first line of the input file contains only the parameter k. The first line (containing the parameter k) should not to be written in the output file.
I wrote the code but i cant figure out something. i read the file, i found the vowels but then i cant print them.
Code: #include <stdio.h>#include <string.h> #include <ctype.h> #define MAX 100 int checkvowel(char c)
I want to make a program that opens a text file and checks the usernames listed in the text files to see if the names are registered on a site such as twitter. How easy would this be to make, what things would I need to know?
I have to optimize a code for below scenario. I am reading stdin (a file redirected to stdin) character by character. How many chars are going to come is not known. After every few chars there is a seaparator. e.g $ as below
rhhrkkj$hghjhdf$ddfkrjt
While reading, if the separator arrives I'm processing the string stored before that separator and then continue reading stdin in same fashion, till EOF. I am using getc(stdin) to read chars.
Using gprof I can see most of the program time is spent inside main() , for this reading logic. Rest of the program is just some insert and search operations. I am getting time of 0.01 secs at the moment, want to reduce further.