using cstring in c++ program isnt running whats wrong?

#include <iostream>
#include <cstring>

using namespace std;

void DisplayAllUpper(char& Days);
void DisplayFirstUpper(char& Days);
void DisplayDaysLength(char& Days, int x);

int main()
{
char Days[5][10]={"monday", "tuesday", "wednesday", "thursday", "friday"};//array of days
int x;

DisplayAllUpper(&Days);
DisplayFirstUpper(&Days);
DisplayDaysLength(&Days, x);



return 0;
}

void DisplayAllUpper(char& Days)
{
//Part a: Change Days to all Uppercase
cout<<"Part A" <<endl;
cout << endl;
for(int i=0; i<5; ++i)
{
strupr(Days[i]);
cout << Days[i]<<endl;
}
}

void DisplayFirstUpper(char& Days)
{
//Part B: Change the first letter of each Day to Uppercase
cout<<"Part B" << endl;
cout << endl;
for(int i = 0; i < 5; ++i)
{
Days[i][0] = toupper(Days[i][0]);
cout<<Days[i]<< endl;
}
}

void DisplayDaysLength(char& Days, int x)
{
//Part C: Show Day of the week and how many letters each day of the week is
cout<< "Part C" <<endl;
cout << endl;
for(int i=0; i<5; ++i)
{
int x= strlen(Days[i][0]);
cout << x << endl;
}
}
closed account (o1vk4iN6)
If your not going to put any effort to explain what you want it to do and what the error is what kind of help do you expect?

Nothing looks wrong!
I was having problems with strupr while running on Ubuntu and OSX. It would not compile. As soon as I tested my code in Visual Studio it worked.
strupr isn't ANSI or POSIX; if you use non-standard functions, it's up to you to make sure they exist.
Last edited on
Topic archived. No new replies allowed.