C + + output = number to the right of all values __c++

Source: Internet
Author: User
Tags strcmp
#include <iostream> #include <string> #include <string.h> #include <stdlib.h> using namespace

Std
  int main () {//find function return type Size_type string s ("=1234=abcd=amde");
  string Flag;

String::size_type position;
    Way one//find function returns the subscript position of JK in s ((position = s.find ("="))!= String::npos) {position++;
    cout << "position =" << position << Endl;    
    Char buffer[32];
    size_t length = s.copy (buffer,4,position);
    Buffer[length] = ' the ';
    cout << "buffer =" << buffer << Endl;
    if (strcmp (buffer, "1234") = = 0) {break;
  }//Mode two #if 0 flag = "=";
  position=0;
  int i=1; while ((position = s.find_first_of (flag, position))!= String::npos) {cout<< ' i= ' << i << ' position
    = "<<position<<endl;
    position++;
    i++;
    Const char* p = strstr (S.c_str (), "=");
    Char buffer[32];
    size_t length = s.copy (buffer,4,position);
    Buffer[length] = ' the '; CoUT << "buffer =" << buffer << Endl;
    if (strcmp (buffer, "1234") = = 0) {break; }} #endif}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.