Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 1st, 2012  |  syntax: None  |  size: 1.20 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using cstring in c   program isnt running whats wrong? [closed]
  2. #include <iostream>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. void DisplayAllUpper(char& Days);
  8. void DisplayFirstUpper(char& Days);
  9. void DisplayDaysLength(char& Days, int x);
  10.  
  11. int main()
  12. {
  13.     char Days[5][10]={"monday", "tuesday", "wednesday", "thursday", "friday"};//array of days
  14.     int x;
  15.  
  16.     DisplayAllUpper(&Days);
  17.     DisplayFirstUpper(&Days);
  18.     DisplayDaysLength(&Days, x);
  19.  
  20.     return 0;
  21. }
  22.  
  23. void DisplayAllUpper(char& Days)
  24. {
  25.     //Part a: Change Days to all Uppercase
  26.     cout<<"Part A" <<endl;
  27.     cout << endl;
  28.     for(int i=0; i<5; ++i)
  29.     {
  30.         strupr(Days[i]);
  31.         cout << Days[i]<<endl;
  32.     }
  33. }
  34.  
  35. void DisplayFirstUpper(char& Days)
  36. {
  37.     //Part B: Change the first letter of each Day to Uppercase
  38.     cout<<"Part B" << endl;
  39.     cout << endl;
  40.     for(int i = 0; i < 5; ++i)
  41.    {
  42.        Days[i][0] = toupper(Days[i][0]);
  43.        cout<<Days[i]<< endl;
  44.    }
  45. }
  46.  
  47. void DisplayDaysLength(char& Days, int x)
  48. {
  49.     //Part C: Show Day of the week and how many letters each day of the week is
  50.     cout<< "Part C" <<endl;
  51.     cout << endl;
  52.     for(int i=0; i<5; ++i)
  53.     {
  54.         int x= strlen(Days[i][0]);
  55.         cout << x << endl;
  56.     }
  57. }