P
P
Peter12112020-12-03 16:08:00
C++ / C#
Peter1211, 2020-12-03 16:08:00

How to insert another word between words in typed text?

#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS
#include <stdio.h>
#include <locale.h>
#include <string.h>
int main(void) 
{
  char text[20];
  gets(text);
  printf("%s",text);
  return 0;
}

5fc8e47b8ef88029200549.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Zhilin, 2020-12-03
@Anton3

The given code... is not ideal. I'll close my eyes to the code and give you an idea.
The carriage return character \rmoves the output to the beginning of the last line, while further output goes on top of it , which is what we want. So: we read the string, we change it as we please, we output \r, we output the modified string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question