How i draw such a thing in .TXT file using file handling. This output must be in columns and rows and in well arranged form.
No. Name Roll No. Physic Math Compuer Science Islamiyat Pak Studies Average Grade 1 Student Name 12345 50 60 70 76 90 81 A 2 Student Name 12345 55 52 50 80 58 55 C 3 Student Name 12345 85 66 90 88 77 75 B 4 Student Name 12345 40 70 91 45 56 85 A 5 Student Name 12345 30 80 80 55 93 45 D
I want to select three columns from my text file i.e. Empl No, Start Date and Created Date. After selecting this, I want to insert the data into a database.
I have attached a copy of the text file.
I have the following code so far:
if (File.Exists(filename)) { string[] lines = File.ReadAllLines(filename); for (int y = 0; y < lines.Length; y++) { Console.WriteLine(lines[y].ToString()); }
How do i select specific details for each employee
how to make the it all work later...but in the mean time how can i get this to display this? Note it has to be made using as a console program. The "Description" and "Cost/ib" collums will be referenced through use of a header file. all else is done by user input and calculations.
I'm having trouble trying to get my loop program to display multiples of 4 in rows and columns. My objective is to print multiples of 4 that are less than 100 in a 4 by 4 format.
So far when I write the code I get 4 8 12 16 20 .... 96 all on the same line.
This is what I expect the code to look like if done correctly.
Here's my code for adding the rows and columns. My problem is that my program displays an incorrect output.
main() { int a[20][20],r,c,y,x,sum=0,rn,cn,cs=0,rs=0; cout<<"Enter number of columns : "; cin>>cn;
[Code] .....
This should be the output Enter number of columns: 4 Enter number of rows: 3 Enter twelve numbers: 9 2 3 4 2 3 1 2 5 6 7 8
The numbers are: 9234 2312 5678 Sum of number 1 column is: 16 Sum of number 2 column is: 11 Sum of number 3 column is: 11 Sum of number 4 column is: 14 Sum of number 1 row is: 18 Sum of number 2 row is: 8 Sum of number 3 row is: 26
Im using apmatrix and im inputting values into a 4 by 4 matrix and im getting all these errors that have nothing to do with my cpp file so im guessing its apmatrixies fault. Also I put in the cpp and header file of both apmatrix and apvector into my project folder. Heres my code:
error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro.c:program filesmicrosoft visual studio 11.0vcincludexkeycheck.h2421TheMatrix
4IntelliSense: identifier "EMIT" is undefinedc:Program FilesMicrosoft Visual Studio 11.0VCincludeyvals.h4911TheMatrix
I am trying to sort a Report Table by which the user can enter any column or row number and output the results. And also sort by names as well. And from my code
#include "stdafx.h" #include<iostream> #include <string> #include<iomanip> using namespace std; #include <stdlib.h> /* srand, rand */ #include <time.h> /* time */
[Code] .....
I know I need to start somewhere with a void function and put in a selection sort.
I have a N queens (actually 8 queens to be specific) program that accepts the numbers in order by row. I need to get it so it accepts the numbers in order by column. At first glance I thought it was just one space different, but it turned out not to be and how to get the one space difference in there. My current code (which I'm aware isn't doing the column accepting right) is:
Code:
#include <iostream> using namespace std; int main() { int board[8]; cout << "Enter the columns containing queens, in order by column: "; for(int i = 0; i < 8; ++i) { cin >> board[i];
[Code]...
What the output should be:
Code:
Enter the rows containing queens, in order by column:
I am writing a program that deals with 2d arrays. The program inputs the number of rows and columns and asks for the entries. When the program run and compiles it works perfectly until it outputs then it gives me a warning.
Here is my code:
#include <iostream> #include <cstdlib> using namespace std; int main() { int row1=0,col1=0,i,j; //int a[row1][col1]; int** a= new int*[row1];
[Code]...
I am learning how to do this before I can move on so it can read a text file of numbers.
Also I am having problems with ////delete [] a[];///// I took it out because it made my code compile and run but when I add it in, it gives me an error:
matrixtesting.cpp|56|error: expected primary-expression before ']' token|
I know this expression is suppose to deallocate the array.
I am trying to iterate a matrix in order to exchange rows and columns element by element. Although the function that exchanges the rows has come out well, i don't seem to figure out how to do the same on columns.The columns switch for a matrix like
You will write a program that uses a multidimensional array having 3 rows and 8 columns and sorts each of the rows using both a bubble sort and a selection sort.
You must declare the array inside of main. You will have a for loop containing the calls to bubbleSort and selectionSort. You need to pass into function bubbleSort and selectionSort the following: 1) each column of the multidimensional array, 2) the size of the column, and 3) a particular row number of the multidimensional array to be used for printing out the "pass" shown on the following pages.
I keep getting an error that the identifier for bubbleSort and selectionSort is not found. (Error C3861)
Also, I feel like I'm missing something in int main() to get it to sort properly.
Code: # include <iostream> using namespace std; int main() { const int SIZE1 = 3; const int SIZE2 = 8; int arr [SIZE1][SIZE2] = { { 105, 102, 107, 103, 106, 100, 104, 101 },
I want know if the query returned zero rows or not.
Don't want to use count(*)
sql = "select * from TABLE where employeefirstname = @First order by EmploymentStatusDescription"; using (SqlCommand cmd = new SqlCommand(sql, conn)) { cmd.Parameters.AddWithValue("@First", First); reader = cmd.ExecuteReader(); } while (reader.Read())
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 am attempting to read values from a file into a 2d array temp[31][2] (31 rows, 3 columns).I only want the values from the file to be read into the first two columns.I believe I am accomplishing that but when I go to print the array, I expect the first two columns to have the file data and the third column to have all zeros. The third column, however is printing such that the value is the next row/first column.
I'm not sure for instance why on the bottom loop for line 1 it doesn't print:
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);
I have a cpp app that reads in a number of files and writes revised output. The app doesn't seem to be able to open a file with a ' in the file name, such as,
N,N'-dimethylethylenediamine.mol
This is the function that opens the file :
Code: // opens mol file, reads in rows to string vector and returns vector vector<string> get_mol_file(string& filePath) { vector<string> mol_file; string new_mol_line; // create an input stream and open the mol file ifstream read_mol_input; read_mol_input.open( filePath.c_str() );
[Code] ....
The path to the file is passed as a cpp string and the c version is used to open the file. Do I need to handle this as a special case? It is possible that there could be " as well, parenthesis, etc.
I need a way to count lines in a .dat file using fscanf. I must use a regex to check that the characters in the file are alphanumeric. In essence I need to count the ' ' character. I know fscanf ignores this character. I need to exit if it detects anything other than alphanumeric with the digit that is "problem" along with the line number. My .dat file is:
Code: howard jim dave joe ( Maggie My fileCheck.c is: Code: #include "main.h" int fileCheck(FILE *fp) { int ret_val; int line_count = 0; char file[BUFF];
[Code]...
The output I am getting is:
Code: file opened Digit: ( is not an alphanumeric character on line: 5 Program will exit! File closed As you can see, the character "(" is not on the 5th line but the 3rd. It is the 5th "string."
So I have this program which read single text file and write in other. Basically read every line then write to another file "this number is n times here + numbers".
How to modify this to store only 1 time the number in second file. What I mean is not like now:
Now output is:
Count of matching numbers in this group: 7 Numbers: 01070400 01070400 01070400 01070400 01070400 01070400 01070400
Is better to be: Count of matching numbers in this group: 7 Number: 01070400
Code that I use is: string path = "text.txt"; var result = (File.ReadLines(path)).OrderBy(x => x).GroupBy(x => x); using (var writer = new StreamWriter("test1.txt")) { foreach (var item in result) { string outGrp = String.Format("Count of matching numbers in this group: {0}", item.Count());