- 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
2 Answers
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