1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Airida [17]
3 years ago
6

Write a program that removes all spaces from the given input.

Computers and Technology
1 answer:
sasho [114]3 years ago
5 0

Explanation:

#include<iostream>

#include<string.h>

using namespace std;

char *removestring(char str[80])

{

   int i,j,len;

   len = strlen(str);

   for( i = 0; i < len; i++)

   {

       if (str[i] == ' ')

       {

           for (j = i; j < len; j++)

               str[j] = str[j+1];

           len--;

       }

   }

   return str;

}

int main ()

{  

char  str[80];

   cout << "Enter a string : ";

   cin.getline(str, 80);

   strcpy(removestring(str), str);

   cout << "Resultant string : " << str;

   return 0;

}

In this program the input is obtained as an character array using getline(). Then it is passed to the user-defined function, then each character is analyzed and if space is found, then it is not copied.

C++ does not allow to return character array. So Character pointer is returned and the content is copied to the character array using "strcpy()". This is a built in function to copy pointer to array.

You might be interested in
What is the main purpose of a graphic organizer?
timama [110]
B. To organize information using shapes.
8 0
3 years ago
Read 2 more answers
How long does a bankruptcy affect your financial reputation
Diano4ka-milaya [45]
It effects it until it is refilled to its normal amount
3 0
3 years ago
The main activity area or the brain of the computer is called the ________
Darya [45]

Motherboard

Its a computer chip



6 0
3 years ago
What is missing link describe briefly with an example class 11?
allsm [11]

A missing link is a long-extinct organism that filled in a gap between closely related species that now coexist on Earth, such as between apes and humans or reptiles and birds.

A possible or recent transitional fossil is referred to as the "missing link." In the media and in popular science, it is widely used to describe any novel transitional form. Initially, the expression was used to describe a hypothetical transitional form that existed between anthropoid ancestors and anatomically modern humans. The term was influenced by both the pre-Darwinian evolutionary theory known as the Great Chain of Being and the now discredited notion that simple species are more primitive than sophisticated ones. Human evolutionary phylogenetic tree. Since evolutionary trees only hold information at their tips and nodes, and the rest is relied on conjecture rather than fossil evidence, geneticists have supported the idea of the "missing link." But anthropologists no longer like it because of what it suggests.

Learn more about missing link  from

brainly.com/question/1968231

#SPJ4

6 0
1 year ago
You have just read about a new security patch that has been made available for your Windows system, so you install the patch as
zhenek [66]

Answer:

A

Explanation:

The best action to take is to download and install the last good update; in that case, it will override the recent unstable update.

An update is not like a single program that can be add or remove from the control panel.

6 0
3 years ago
Other questions:
  • One of the most famous ___ licenses is gpl, which ensures that a particular program remains free to distribute and allows its co
    10·1 answer
  • What is the name of the most expensive car and how much is it and what are its features
    15·1 answer
  • In learning information security, it is important to understand that threats to your company's information assets are present 24
    13·1 answer
  • How many of the colonists of Jamestown died before they made it to shore, due to the difficult voyage?
    15·1 answer
  • Why is it important to isolate evidence-containing devices from the internet?
    11·1 answer
  • This can change the fit of your respirator. A) A mustacheB) A beardC) Weight gainD) All of the above
    15·1 answer
  • Which important aspect of the Roman Empire did the barbarians destroy?
    14·2 answers
  • Analyze the error in the html code :<br><br> HTML
    9·1 answer
  • Brianna is feeling overwhelmed by the amount of digital
    13·1 answer
  • 30 POINTS FOR THE CORRECT ANSWERS
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!