C++ help

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
   /*
* @author Damian Bloch
* Chapter08 Project02
* Program is to let the user enter a string and 
* will output the sting in all uppercase letters.
*/

#include <cctype>
#include <iostream>
#include <string>

using namespace std;
char str1[80];

int main ()
{
  string input;
  string output;

  cout << "Enter a string of characters: ";
  cin >> input >> cin.get(str1, 80);
  cout << endl;

  for(int i=0 ; i < input.size() ; ++i) 
	{
		input[i] = toupper(input[i]);
	}

  cout << "The uppercase letters are: " << input << "\n"; 

  return 0; 
}



I need help with this code.
im trying to get the cin.get working where the user is allowed to enter an 80 character string and I have no idea on how to do that.
You want getLine: http://www.cplusplus.com/reference/istream/istream/getline/
Line 21 should be cin.getLine(input, 80);
Topic archived. No new replies allowed.