How can I modify my code so that gives me seemly output?

how to automate excel reports using macros
excel macro examples
excel macros
macros in excel for beginners
excel macro examples download
how to create macro in excel 2019
excel macro tips
linux commands explained

my input is like this (the first two line of input):

{4 <1,-1,-1> <1,1,-1> <-1,1,-1> <-1,-1,-1>} //first line
{4 <1,3,-1> <1,1,-1> <1,1,0.5> <1,3,0.5>}
{4 <1,3,-1> <-1,3,-1> <-1,1,-1> <1,1,-1>}
{4 <-1,3,-1> <-1,3,0.5> <-1,1,0.5> <-1,1,-1>}
{4 <1,3,0.5> <1,1,0.5> <0.75,1,1> <0.75,3,1>}
{4 <-0.75,3,1> <-0.75,1,1> <-1,1,0.5> <-1,3,0.5>}
{4 <-0.75,3,1> <0.75,3,1> <0.75,1,1> <-0.75,1,1>}
{4 <1,-1,0.5> <1,-0.75,1> <3,-0.75,1> <3,-1,0.5>}
{4 <1,-1,0.5> <3,-1,0.5> <3,-1,-1> <1,-1,-1>}
{4 <1,-1,-1> <3,-1,-1> <3,1,-1> <1,1,-1>} //tenth line

I have a code like this, which I expected to read each bracket in order, namely 1,-1,-1, then search them in input file to fine similar bracket and showing them, but it does not:

#include <iostream>
#include <vector>
#include <string>
#include <fstream>  
using namespace std;

using vecstr = vector<string>;

vecstr splitOut(const string &line) {
  size_t  pos = 0;
  vecstr result;
  while ( (pos=line.find('<',pos)) != string::npos ) {
    size_t endpos = line.find('>',pos);
    if ( endpos != string::npos ) {
      string token = line.substr(pos+1,endpos-pos-1);
      result.push_back(token);
    } else {

    }
    pos = endpos;
  }
  return result;
}

int main ( ) {

    ifstream iss("a.txt");
    string line;
    int offset;
    unsigned int curLine = 0;

    while (getline(iss,line)){
        string test = line;
        vecstr result = splitOut(test);
        for ( auto s : result ) {

            while(getline(iss, line)) { 
                curLine++;
                if ((offset = line.find(s, 0)) != string::npos) {
                cout << "found: " << s << " line: " << curLine << endl;
                }
            }
        }
    }
}

all of output that code shows (I mean it does not consider other brackets as well as the lines showed for first line are incorrect, they should be 9 and 10):

found: 1,-1,-1 line: 8
found: 1,-1,-1 line: 9

how can I change program to show me an output like this (for example for first bracket, i.e. 1,-1,-1):

found: 1,-1,-1 line: 9
found: 1,-1,-1 line: 10

Handbook of Driving Simulation for Engineering, Medicine, and , Then use this variable throughout the code rather than the fixed value of 60. This provides greater flexibility, but more importantly it forces the person using the to ensure the value change is carried throughout the data reduction code while when defining the structure of input and output data arrays in the reduction code. Building Java Programs (4th Edition) Edit edition. Problem 14E from Chapter 2: Modify the code so that it now produces the following output Get solutions

I have to admit, I do not really understand the logic of your code, or how you get the output you get. Anyhow, I am pretty sure that this cannot be correct...

Here:

while (getline(iss,line)){
    string test = line;
    vecstr result = splitOut(test);
    for ( auto s : result ) {

        while(getline(iss, line)) { 
            curLine++;
            if ((offset = line.find(s, 0)) != string::npos) {
            cout << "found: " << s << " line: " << curLine << endl;
            }
        }
    }
}

By the time you reach curLine++ you already read 2 lines via getline(iss, line) so your line numbers must be off. Also, once you read all lines via the inner getline the outer loop has nothing to read anymore.

Instead of trying to jump back and forth in the file you should read it once and then work on data in memory. I would suggest a data structure that holds all data from one line. Something along the line of:

struct entry {
    size_t line_number;
    std::array< std::array< int,3> 3> triples;
};

Read them, store them in a vector and then calculate the desired result.

InfoWorld, Just writing the code for your application's user interface requires an in-depth to control the input/output fields of data items in the dialog box, such as check boxes, radio CASE:W also provides support for unlinked dialog boxes (which are not linked You can modify the code after it is generated by CASE:W, but if you  i got a code from other forum about tracking changes, but the problem after i insert this code i can't do undo. can someone modify this code, so i still can do undo features thanks . Option Explicit. Public preValue As Variant. Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub Target.ClearComments

If you intend to count lines when you read them, you need to count every line that you read:

while (getline(iss,line)) {
    ++curLine;     //   <----------- count here
    string test = line;
    vecstr result = splitOut(test);
    for ( auto s : result ) {

        while(getline(iss, line)) { 
            ++curLine;     //   <----------- as well as here

Quick Reference: Building Cacti Network Monitoring, I would also say that they responded quite fast in helping to solve my and design an application in such an easy way to implement and customize it. We just try to understand the pattern of the codes (XML or Perl), how to define input, output, Seemingly, we won't face any serious issue once we use script to enhance  Though this problem seems complex, the concept behind this program is straightforward; display the content from the same file you are writing the source code. In C programming, there is a predefined macro named __FILE__ that gives the name of the current input file.

Using a map data structure and recording the line numbers of the triples in a vector, the problem becomes easily implemented.

The assumption is that the input is as you've given -- a {number <triplets>…}, where triplets are the line of triplets, where each triplet has no whitespace between the numbers.

Given all of that, here is a small example with comments:

#include <unordered_map>
#include <string>
#include <vector>
#include <sstream>
#include <iostream>

std::string test =
"{4 <1,-1,-1> <1,1,-1> <-1,1,-1> <-1,-1,-1>}\n"
"{4 <1,3,-1> <1,1,-1> <1,1,0.5> <1,3,0.5>}\n"
"{4 <1,3,-1> <-1,3,-1> <-1,1,-1> <1,1,-1>}\n"
"{4 <-1,3,-1> <-1,3,0.5> <-1,1,0.5> <-1,1,-1>}\n"
"{4 <1,3,0.5> <1,1,0.5> <0.75,1,1> <0.75,3,1>}\n"
"{4 <-0.75,3,1> <-0.75,1,1> <-1,1,0.5> <-1,3,0.5>}\n"
"{4 <-0.75,3,1> <0.75,3,1> <0.75,1,1> <-0.75,1,1>}\n"
"{4 <1,-1,0.5> <1,-0.75,1> <3,-0.75,1> <3,-1,0.5>}\n"
"{4 <1,-1,0.5> <3,-1,0.5> <3,-1,-1> <1,-1,-1>}\n"
"{4 <1,-1,-1> <3,-1,-1> <3,1,-1> <1,1,-1>}";

int main()
{
    // map of "<x,y,z>" strings to a vector of line numbers where <x,y,z> is found
    std::unordered_map<std::string, std::vector<int>> triplet_map;  

    std::istringstream strm(test);
    std::string line;
    std::string triplet;

    int line_number = 1;
    while (getline(strm, line))
    {
        // remove the ending }
        line.pop_back();

        // find the first <
        auto first_pos = line.find_first_of('<');

        // start reading from there
        std::istringstream linestrm(line.c_str() + first_pos);
        while (linestrm >> triplet)
        {
            // insert the triplet in the map if not already there
            // insert() returns an iterator to the inserted item, or the existing
            // item in the map if not newly inserted.
            auto pr = triplet_map.insert({ triplet, std::vector<int>() });

            // record the line number in the vector
            pr.first->second.push_back(line_number);
        }
        ++line_number; // update the line number
    }

    // Output statistics
    for (auto& m : triplet_map)
    {
            // Only output if vector size is > 1
        if (m.second.size() > 1)
        {
            for (auto& v : m.second)
                std::cout << "found: " << m.first << " line: " << v << "\n";
            std::cout << "\n";
        }
    }
}

The output would look similar to this:

found: <3,-1,-1> line: 9
found: <3,-1,-1> line: 10

found: <3,-1,0.5> line: 8
found: <3,-1,0.5> line: 9

found: <-0.75,1,1> line: 6
found: <-0.75,1,1> line: 7
…

Here is a live example.

Computerworld, the one newspaper that can E give you all the current ' information you need to already a subscriber, but l'd like you to change my: My current mailing label is and averaging lines of code produced as a means of achieving a productivity indicator. Productivity is the ratio of output to input where input includes labor, The  As the name implies, output window is only for displaying output. It seems that you're using VSCode Coderunner extension, which by default runs program in output window. To change it to terminal, simply put : "code-runner.runInTerminal": true In your VSCode User Settings (shortcut: Ctrl + ,).

PC Mag, Also included are sections on the control codes for each emulation and a section This method makes it easy to change a font or print orientation by software to current font. lt also indicates such infomration as the fonts currently in the printer. you endure a seemingly interminable wait before the printer produces the first  for loop checks condition before execution and you have initialized the value of i to zero hence the condition is false so you are not getting any output. To Correct it, declare for loop as: for(i=0;*(c+i)!='\0';i++)

Real World Enterprise Reports Using VB6 And VB .NET, If your volume of mail is so great that it cannot be realistically done in house, Optionally, you can simply give them the raw data, and they will create the print a client's seemingly simple request to display sales rep names via a zip code join you'll then need to scramble to adjust your applications to handle the change. You can set breakpoints in your code and use the QuickView function to see the state of an object or the direct window to print infos or modify objects. You could e.g. use Debug.Print from namespace System.Diagnostics to dump information to the direct windows and so on.

Energy Research Abstracts, Off-Site Storage: Preparing for the Worst READER COMMENTARY/Frank C. Fillmore Jr. rarely have been presented in such detail or in such a reasonable fashion. problems [CW March 30], I was struck by two seemingly unrelated thoughts. and resistance to change within the middle levels of the DP department itself  Right-Mouse click on your HTML file and Open WithNotePad. NotePad will open the HTML file in code format so you can begin editing immediately. TextEditis the default plain text editor on Apple Mac machines. Right-Mouse click on your HTML file and Open WithTextEdit.

Comments
  • You asked (and deleted) the same question a few hours ago. What changed between this question and that?
  • one person said your question is long, and also said "post a minimal reproducible example of your question".
  • You seem to be writing your c++ like a c programmer, lee. Depending on your purpose, why not make more use of istream, or use regex, or even use a lexer - eg in boost::spirit? cf. ciere.com/cppnow15/x3_docs/spirit/tutorials/warming_up.html
  • you could have edited the question to fix it. Not sure, but I think you can even delete a question, edit and then undelete it
  • you nicely reduced the code, but you reduced the input too much. Especially the lines you expect to see in the output are missing. Do you want to start counting the lines at 0 or at 1? The code seems to start at 1...