I have a problem with a lab. I need to write different set of programs with strings. The different things I need to figure out for ouput are the capital letters, what each word starts with, the punctuation, etc. Can anyone at least help me get started?

Recommended Answers

All 5 Replies

// add code
int main(void)
{
   // add code
   return 0;
}

i think i am starting to get it but I am bit sure how to declare a string

int main ()
{

    string sentence;


cout << "Programmed By: Bryan Kruep \n" <<endl;

    cout << "Enter a sentence: ";
    cin >> sentence;



                return 0;
    }

Output the characters of the string one at a time, toupper will make each uppercase.

Words are typically whitespace delimited.

I am starting to get it but when I run the following info the string variable is only the first word so I must have declared the string sentence wrong and if this doesnt use code tags please let me know so I can make it easier for you guys

int main ()
{

	string sentence;




	cout << "Programmed By: Bryan Kruep \n" <<endl;

	cout << "Enter a sentence: ";
	cin >> sentence;

	cout << endl << "Your sentence is:" << endl << sentence;

	cout << endl << endl << "The capital letters are:";

	cout << endl << endl;

	cout << "Your original sentence was:" << endl << sentence;

	cout << endl << endl;


	



				return 0;
	}

Use getline.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.