i have to do a code that takes the word from the user and seperate them from uppercase and lowercase.
i had done the code, but the words that are printed out are not as aspected (symbols)
#include<iostream>
#include <ctype.h>
using namespace std;
int main(){
int i=0;
int total_char=0;
cout<<"enter number of characters: ";
cin>>total_char;
char str[total_char];
char uppercase[total_char];
int num_upper=0;
char lowercase[total_char];
int num_lower=0;
char x;
cout<<"enter word: ";
cin>>str;
for(i=0;i<=total_char;i++)
{
x=str[i];
if(isupper(x))
{uppercase[i]=x;
num_upper++;}
else
{lowercase[i]=x;
num_lower++;}
}
cout<<"uppercase character: ";
for(i=0;i<num_upper;i++)
cout<<uppercase[i];
cout<<endl<<endl;
cout<<"lowercase character: ";
for(i=0;i<num_lower;i++)
cout<<lowercase[i];
cout<<endl<<endl;
system("pause");
}