0
Help me
a. Write code c++ that defines a function that takes your full name as a parameter and returns the modified name with the abbreviation of the middle name only, as follows: input: Rami Yusuf Daraghma return: Rami Y. Daraghma b. Important notes to be considered in your solution: 1. do not use string library functions such as (strlen,strcpy,.., etc) 2. use char s[] to define the full name 3. do not use string class data type. 4. you can use gets_s() or getline to read the full name c. Write a test program that uses the function above on your full name and then repeat the function call on your friend's full name.
5 Respuestas
+ 3
Delete other one and show your attempts.
https://www.sololearn.com/discuss/2928564/?ref=app
https://www.sololearn.com/discuss/2928563/?ref=app
+ 3
char* modified(char* s)
{
char* m = new char;
int j = 0;
int f = 0;
for(int i=0; i<50; i++)
{
if (f==0) {
if (s[i]==' ') f=1;
m[j] = s[i];
j++;
} else if (f==1) {
m[j] = s[i];
j++;
m[j] = '.';
j++;
f=2;
} else if (f==2) {
if (s[i]==' ') {
m[j] = s[i];
j++;
f=3;
}
} else {
m[j] = s[i];
j++;
}
}
return m;
}
https://code.sololearn.com/cC0M3BGCrM7w
+ 2
⭐Nakul Pasi S/0 Krishnalal Pasi⭐
Stop posting copy answer.
+ 1
#include <iostream>
using namespace std;
void remove(char* s,int n)
{
for(int i=n;s[i]=NULL;i++)
s[i]=s[i+1];
}
void fun(char* s,int n)
{
for(int i=n;s[i]=NULL;i++)
if()
s[i+2]='.';
while(s[i]!='')
i++;
remove(s,i+);
}
int main()
{
char name[50];
cout<<"enter your full name:";
cin.getline(name,50,/n);
cout<<"\n modifide name:";
cout<<fun(s,n)<<endl;
return 0;
}