How do I print the name ended with a specific character in a group, please help | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
- 1

How do I print the name ended with a specific character in a group, please help

♥️

28th May 2022, 3:15 PM
Ali waleed
1 Réponse
0
#include <stdio.h> #include <iostream> int main() { char name[80] = {'\n'}; char symbol = 33; // 33 is ASCII code, But you can write '!' std::cin >> name; for(int i = 0; i < 80; i++) { if(name[i+1] == '\0') { name[i+1] = symbol; break; } } printf("%s", name); return 0; }
28th May 2022, 5:23 PM
Ulysses Apokin
Ulysses Apokin - avatar