- 1
How do I print the name ended with a specific character in a group, please help
â„ïž
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;
}