hello everyone i am new to this community . i am having a problem right now with arrays. So basically this program let user to enter anything in lowercase and then convert it to uppercase(if user input uppercase it will stay the same). Because i am not allowed to use toupper(), i subtract 32 from lower case ASCII code so that i get upper case.

my problem is the console output,as you can see '╠' these are weird characters. can anyone tell me how to omit those in the console output?

Please Enter a string of 80 or fewer characters
HeLLo EveRyONE
HELLO EVERYONE ╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠
╠Press any key to continue . . .

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	const int NUM_LETTERS = 81;     //80 characters and 1 space for null terminator
	char line[NUM_LETTERS];
	char newline;
	cout<< endl << "Please Enter a string of 80 or fewer characters" << endl;
	cin.getline(line,NUM_LETTERS);             //get string from user


	for (int count = 0 ;count < NUM_LETTERS; count ++)       //loop
	{
		if(line[count]>= 97 && line[count]<=122) // check if characters are lowercase.
		{
		  line[count] = line[count] - 32; // convert to uppercase.
		  
		}
		else if (line[count] >=65 && line[count] <=90); //check if there are uppercase in userinput.
		{
			line[count] = line [count];   //upper case stay the same.
		
		}
		cout << line[count];
	}
}

cout << line[count] // <--- you are returning uninitialized data, as the variable count can be greater than the size of your input.

i just solved it already. thank you anyway

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.