And it will keep updating like this and I want to update the previous numbers I extracted with now the new numbers after the 4,5, and 6 space.
So I have to write a code to let it know when it encounters [ [ start looking for the 4,5,6 space and get those numbers and once it reaches ;... that's the end of that section so re-look for the next section of numbers after the 4,5,6 space.
The file will be a text file or matlab file that is always being updated with these sections of numbers. Can I make this a #include<nameoffile.h> or does .h not work with a file that is always being updated.
I need to extract comments from a C file, which are usually marked with " /* This is a comment */ ". It seems to me that I need to calculate first at what position is the / and then ask it if on the very next position to the / operand is the *, if it is then I need check where is the next * and if / operand is immediately next to it. At last I need to take everything between values that the first and second * have. But I don't know how to write that in code.
how to extract certain cells for an excel file that is continuously updating. I had a look at [URL] since they provide a .h library that is useful for this situation, but could not find any code.
I am trying to iterate through a file path to extract the file name. since the . separating the name from the extension is a unique character, i thought i would reverse iterate from the . to the first separating directories. however, when trying to reference the memory location of the position of the . in the string, i am getting an i-value error:
for (std::string::reverse_iterator iter = &(songPath.find('.')); iter != songPath.rend(); ++iter) { if (*iter == '') break; else songName.push_back(*iter); }
I need to develop a simple program, i have 2 variables (begin, end), and i need to search in a file, And extract the string between the Begin and the End variables to a new File, For Example:
my text file: file.txt:
some text here<StartHere>more text here</EndHere>text text
//And now, search in the Text file, And Extract the text between the begin string and the End string. <...>
The Result should be: NewFile.txt with the content:
<StartHere>more text here</EndHere>
That's it!, Here is what i have for now:
#include "stdafx.h" #include <iostream> #include <fstream> #include <vector> using namespace std; int main() { int ocurrences_count = 0; int ocurrences2_count = 0; char word[20]; //this array will save user input
I need to write a C++ program, that extracts certain variables, x y z, from a file that is continuously being updated x y z. These variables are going to be used to recalculate a new answer.
My question is to see if it is possible to have an include .h file that is always being updated so that I can extract these three variables from it, and always have the newest venison of each variable, so that the answer to the equation is always the newest updated. Should I use fopen or fwrite to do this.
Basically I have a text file called words. I'm supposed to extract a word randomly form the file and have the user guess the word. If they guess the word correctly in x number of tries they will receive the definition.
I'm having trouble receiving that random word and I'm getting the definitions from the file.
This is what is in the words.txt file apple#the usually round, red or yellow, edible fruit of a small tree boat#a vessel for transport by water horse#a solid-hoofed plant-eating domesticated mammal with a flowing mane and tail, used for riding television#a system for transmitting visual images and sound that are reproduced on screens soup#a liquid dish, typically made by boiling meat, fish, or vegetables, etc. bottle#a container, typically made of glass or plastic and with a narrow neck barber#a person who cuts hair toast#sliced bread browned on both sides by exposure to radiant heat radar#a system for detecting the presence, direction, distance, and speed of aircraft, ships, and other objects red#of a color at the end of the spectrum next to orange and opposite violet
Ben has been administering a MBTI personality test. Now he has all the responses, but the task of scoring and compiling results seems daunting. The personality test* is a series of 70 questions for which the available responses are ‘A’ and ‘B’. Based upon the answers to the 70 questions, a personality profile is determined, categorizing the degree to which the responses place the person on four scales:
Extrovert vs. Introvert (E/I) Sensation vs. iNtuition (S/N) Thinking vs. Feeling (T/F) Judging vs. Perceiving (J/P).
Each of the 70 questions relates to one of the four scales, with an ‘A’ response indicating the first of the corresponding pair (E, S, T, or J) and a ‘B’ indicating the second (I, N, F, or P). For instance, an ‘A’ response on the question: At a party do you:
A. Interact with many, including strangers B. Interact with a few, known to you indicates an Extrovert rather than an Introvert; just the opposite for a ‘B’.
For this test, each question is designed to influence one of the four scales as follows: questions 1, 8, 15, 22, 29 … are used to determine E/I, questions 2, 9, 16, 23, 30 … and 3, 10, 17, 24, 31 … to determine S/N, questions 4, 11, 18, 25, 32 … and 5, 12, 19, 26, 33 … to determine T/F, and questions 6, 13, 20, 27, 34 … and 7, 14, 21, 28, 35 … to determine J/P. Notice these come in sequences of “every 7th” question.
The goal of the test is to determine which end of each of the four scales a person leans, and to thus classify him/her based on those leanings (e.g., as ENFJ, INTJ, etc.). Since Ben would also like an indication of how strongly the test taker fell into each of the four, the program should print the percentage of ‘A’ responses for that scale.
Input for this program should come from a file responses.txt. The first line of the file will contain a single integer, n, indicating the number of test results to follow. Each of the following n lines will contain the first name of the test taker, a single blank, his/her last name, a single blank, then the 70 responses he/she gave on the test. Although the test instructions indicate that the results are most valid when all questions are answered, sometimes respondents leave questions blank. In that case, a dash appears at the corresponding place in the list of responses.
Output for the program should be written to the file types.txt. It should include a well-formatted report listing, for each test taker, his/her name, the percentage of ‘A’ responses in each scale, and the resulting personality type. A tie within a scale should result in a dash (‘-‘) for that part of the personality type.
I am trying to stream data to a file, and then return to the file to add further data. When I add data the second time, I then want to update the value of the second byte in the whole file. I can't seem to do this!
Here is my sample code:
Code: int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; int x; fstream out1("file.dat", ios::out | ios::binary | ios::trunc);
[code]....
The output I get is "1, 2, 3, 4, 5, 6", but I want to be getting "1, 7, 3, 4, 5, 6", because in "out2", I seekp to the second integar entry, and change it to "7".
I have also tried using ios::ate in the constructor for "out2", but this gives me the out put "4, 7, 6, 6, 6, 6", which is suggesting that when I create my fstream object "in", any seekg commands are relative to the beginning of the "out2" stream, rather than the "out1" stream.
#include <iostream> #include <fstream> using namespace std; int main() { int r = 0; int c = 0; int num[17][15] = { 0 }; [Code] ...
// Here is my code for displaying the data from the text file into a 2d array and height next to it, but I am not able to diaplay the height from 60 to 76 next to the row of the 2d array, as shown in the table below. This is my program:
Recently the health authorities have listed a new way to calculate the body mass index (BMI) of an individual. Values of 20 – 24 are classified as normal, 25-29 as overweight, and 30-34 as heavy.
The table below is a portion of a typical BMI table.
Since the calculation I performed gives me -71.77 Volts, I need to match this value to the time that this occurs closest to using my program, and output the time that this occurs at.
Here is my program so far: int main() { std::ifstream inFile; inFile.open("AP.txt"); ofstream results_file ("maxvaluewithinput.txt"); float TimeAtdVMax = 0; float VoltsAtdVmax = 0;
[Code]...
If you're curious, this program isn't for homework. It's part of the independent learning on C++ I'm doing for a Master's Thesis; the program will eventually model the APD90 of a ventricular action potential.
I need to use the output of my IF statement in a calculation. But how can i extract the output from the IF statement in my code?
#include <iostream> #include <cmath> using namespace std; int main(int argc, char *argv[]) { double x, y, z; cout<<"Please enter the student's three test grades:"<<endl; cin>>x>>y>>z;
I have a std::vector<int> and I want to modify subset of the elements. I thought I might be able to use:
std::vector<int> a = { 1,2,3,4,5,6,7,8,9 }; std::vector<int> b(&a[3],&a[7]); for(auto& each : b) { each++; } for(auto& each : a) { std::cout << each << " "; }
but that didn't work. The elements of 'a' retain their original values. Then, I thought, "Ooo, maybe I could make 'b' a reference." Nope. What approach would be to access a subset of a vector for potential alteration?
Its to extract some images from .adf files, I have had it working about 2 years ago but now i cant figure out the right directory.
Code:
using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; using System.Text; namespace ADFReader{ class Program { public static int ApplyOffset(int data, int offset) [Code] ...
Suppose I have read a line from an ASCII file with fgets(). Now I want to parse the line, which looks something like this: Code: # John Q. Public et al. 2014, to be submitted The name, "John Q. Public" is what I want. However, the name can be anything, consisting of 1 or more tokens separated by spaces. it could be "John" Or "John Public", or "Thurston Howell the 3rd", or etc... Bascially, I need to get the entire substring between the first hash mark, and the "et al" in the line. I tried this: Code: sscanf(line,"# %s et al.",name); But I can only get the first token (which, in this case, is "John").
I am very very new to C++. A bit of background. I have been writing in excel vba for large number crunching, and the code is now taking quite a while to run. A friend of mine suggested i start writing in C++, so i read up on it. And downloaded Code:Blocks.
My VBA Code is:
Sub arrayss() Dim NameArray As Variant Dim datarray As Byte Dim DirectionArray As Variant Dim WinArr As Variant
[Code] .....
Ultimately i would like to recode this to C++, but my first and probably silly question is how do i get the data from Excel to use in C++. I was thinking either to put the data in 3 csv files and convert into three Arrays in C++. Or maybe create a library of the data in C++. Ultimately it is speed i am looking for, so before i start recoding i wanted to start with the best way.
The data is like this in excel: (don't know how to create a table)
So the headers would be in one array, the 15's, 30's etc would be in another array and the 1's and 0's and Empty ( i need it to record an empty cell) would be in another array...
I have a stored procedure, which I cannot change (it is used by older programs). It is passed an int of 15 and then an ID is generated and written to a database table. The created ID is then suppose to be selected and returned.
The INSERT does not seem to be working. I'm not getting the created ID value from my code, I am getting the value I passed to the procedure when I get to this
line of code "sessionID = sessionProcedureID.Value.ToString()";.
Below the stored procedure and my code.
/***************Stored Procedure***********************/ USE [testDataBase] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[MakeValue]
i need to search for a keyword in a binary(.raw)file and have to extract the characters(until a '&' character is found)that immediately following the keyword .