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]
4 years ago
6

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

Computers and Technology
1 answer:
sasho [114]4 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
State the difference between IBM PC and apple machintosh computers
azamat

Answer:

a Mac is a PC because PC stands for personal computer. However, in everyday use, the term PC typically refers to a computer running the Windows operating system, not the operating system made by Apple.

7 0
3 years ago
Easy STEAM question :)
lorasvet [3.4K]

Answer:

Explanation:

A civil Engineer builds buildings, roads and bridges.

4 0
4 years ago
Read 2 more answers
Need help please will mark brainliest
aleksklad [387]

Answer:

intranet

Explanation:

An intranet is a private network that you can't access outside the physical boundary of an organization

7 0
3 years ago
Is a mushroom a consumer or a producer or a decomposed
nydimaria [60]
<span>They are decomposers, they breakdown dead plants and animals and release</span>
5 0
3 years ago
Read 2 more answers
I need to get 20 websites about Artificial Intelligence (not Wikipedia) for 20 annotated bibliographies.
adell [148]

Answer:

https://books.google.com/books?id=H39dDwAAQBAJ&pg=PA452&lpg=PA452&dq=20+websites+for+Artificial+Intelligence+for+annotated+bibliographies.&source=bl&ots=Pe9AafWxCM&sig=ACfU3U3B_5nwtNBg8l92tgZekJVmdvbYCA&hl=en&ppis=_e&sa=X&ved=2ahUKEwjW49PYgvznAhUMZd8KHZQHBZIQ6AEwAHoECAsQAQ#v=onepage&q=20%20websites%20for%20Artificial%20Intelligence%20for%20annotated%20bibliographies.&f=false

Explanation:

4 0
4 years ago
Other questions:
  • Effective collaboration requires a proactive and holistic strategy that integrates business goals and technology potential.
    15·1 answer
  • the command prompt window should be avoided because it is dangerous to do commands there? True or false
    14·1 answer
  • After your yearly checkup, the doctor has bad news and good news. The bad news is that you tested positive for a serious disease
    9·1 answer
  • Given two 3x3 arrays of integer, x1 and x2, write the code needed to copy every value from x1 to its corresponding element in x2
    6·1 answer
  • The Printer Event 1 P1 requests and is allocated the printer R1. 2 P1 releases the printer R1. 3 P2 requests and is allocated th
    10·1 answer
  • How many bytes are there in 256 Kbytes?
    6·1 answer
  • A rugby team has 15 players. A bus company has big buses that can carry 48 passengers and small buses that can carry 10 passenge
    10·1 answer
  • Determine the distance between point (x1, y1) and point (x2, y2), and assign the result to points Distance. The calculation is:
    12·1 answer
  • Describing Report Viewing
    5·1 answer
  • A computer hardware feature that is vital to the effective operation of a multiprogramming operating system is:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!