B
B
Bogdan Oleksandrovich2016-02-23 16:09:50
C++ / C#
Bogdan Oleksandrovich, 2016-02-23 16:09:50

How to derive a patronymic from a row that consists of a surname, name and patronymic?

Unable to withdraw. Outputs something's name (

#include <iostream> 
#include <string.h> 

using namespace std; 
int main(int argc, char** argv) 
{ 
  char name[50]; 
  char *p, *r, *y, *h; 

  cout << "Enter name" << endl; 
  cin.getline(name, 50); 
  int x, g; 
  x = strlen(name); 
  cout << x << endl; 
  int a = 0; 
    for (int i=0; i<50; i++) 
  { 
    if(name[i] =='a') 
    a++; 
  } 
  cout << "Kilkist \"a\" = " << a << endl; 
  p = strchr(name, ' '); 
  strtok(p, " "); 
  cout << " Name   " << p << endl; 


  h = strchr (p, ' ');
   strtok(h, " ");
  
  cout << "3 word     " << h << endl; 
  g = strlen(h);
  cout << "Size word " << g << endl;
  return 0;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
Bogdan Olexandrovich, 2016-02-23
@idbogdanbabitskiy

thank)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question