C++ Program: Write a Program to Read Paragraphs

  • Comp Sci
  • Thread starter abedhamayl
  • Start date
  • Tags
    C++
In summary, the conversation involved a request for help on a program that reads a paragraph of 4 lines of text and outputs a table indicating the occurrence of each letter of the alphabet, the input paragraph without extra spaces, the average word length, the list of words in alphabetical order, and the 4 lines in the paragraph sorted by length. The conversation also included a reminder to post homework questions in the appropriate forums and a request for the user to show their own work and thoughts on the problem.
  • #1
abedhamayl
4
0
Write a program that reads a paragraph of 4 lines of text. The user can enter extra spaces between words. The length of each line does not exceed 50 characters. The program should output the following: ((Use pointers))

1. A table indicating the occurrence of each letter of the alphabet in the text.
2. The input paragraph without extra spaces between words.
3. Average word length in the paragraph.
4. The list of words in the paragraph sorted in alphabetical order.
5. The 4 lines in the paragraph sorted in ascending order of length.


please help me
 
Physics news on Phys.org
  • #2
Please post homework questions in the appropriate homework forums. (I have moved this thread there)

And please review our homework policy -- we will not do your work for you! You must indicate what work you've done, and what thoughts and analyses you've done on the problem -- if you don't show us that you've worked on the problem, then we won't work on the problem either.
 
  • #3
just i want to
char *n[40][50];
cin>>*n;
how i can enter the names in this array and stop will i enter the new line
 
  • #4
i use a
visual stdio 6.0
 
  • #5
wher are you
 

1. What is a C++ program?

A C++ program is a computer program that is written in the C++ programming language. It is used for a variety of purposes, including creating applications, games, and system software.

2. How do I write a C++ program to read paragraphs?

To write a C++ program to read paragraphs, you can use the getline function from the iostream library. This function allows you to read a line of text from the user and store it in a variable. You can then repeat this process to read multiple lines and store them in a string or array.

3. Can I read paragraphs from a file using a C++ program?

Yes, you can read paragraphs from a file using a C++ program. You can use the ifstream class from the fstream library to open a file and then use the getline function to read the contents line by line.

4. How do I display the paragraphs that I have read in my C++ program?

To display the paragraphs that you have read in your C++ program, you can use the cout statement to output the contents of the string or array that you have stored the paragraphs in.

5. Can I manipulate the paragraphs in my C++ program?

Yes, you can manipulate the paragraphs in your C++ program by using string manipulation functions such as substr and find. These functions allow you to extract specific parts of the paragraph or search for certain words within it.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
14
Views
2K
Back
Top