You are viewing our Forum Archives. To view or take place in current topics click here.
In need of some HELP!! [C++]
Posted:

In need of some HELP!! [C++]Posted:

hah09
  • Resident Elite
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
In need of some help! I have recently just started university and I have never coded c++ before in my life! Things are starting to get kind of tricky for me now! Any pointers to some books I could read that are helpful would be much appreciated!

ALSO!!

Would any of you be able to help me off with this question I have for part of one of my assignments would be great!

Design and implement a program that outputs the calendar for the month in the following
format:
M T W Th F S Su
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

Arrange for your code to output seven lines for the calendar output even if some of those lines are empty. The data (input) for the program should consist of the number of days in the month and the day on which the month starts, such as 1 = Monday, 2 = Tuesday

The input values of 30 and 7 would be required to get the output shown above.
Once you have a working programme, make a copy and adapt this so the program
continues until the user enters zero for the number of days in the month. You should also check for valid data (where possible) given the context of this program. Submit only the program that compiles and runs.

Call this program Calendar.cpp

also I cannot use anything like arrays or anything to that extent! it has to be out of for, while and do loops.

Thanks for any help on this would be appriciated! I am not asking for you to do my work! I just want some sort of guidance to the right way about doing it!
#2. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Have you got anything so far?

Most of the people in this section don't tend to help unless we've seen at least some effort has been put in.
#3. Posted:
hah09
  • Resident Elite
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Sure! Im fairly new to c++ coding and also to this part of TTG anyways!

I have this part of my code for like a sort of base design to work off


#include <iostream>
#include <iomanip>
using namespace std;
int main(int argc, const char * argv[]) {

   
    int a = 1;
   
    cout << "\t M" << "\t T" << "\t W" << "\t Th" << "\t F" << "\t S" << "\t Su" << endl;
   
    while(a == 1)
    {
        cout << setw(30) << a << endl;
        break;
    }
    while(a < 8){
        a++;
        cout << "\t"<< setw(2) << a;
        cout << " ";
    }
    cout << " " << endl;
    while(a < 15){
        a++;
        cout << "\t"<< setw(2) << a;
        cout << " ";
    }
    cout << " " << endl;
    while(a < 22){
        a++;
        cout << "\t"<< setw(2) << a;
        cout << " ";
    }
    cout << " " << endl;
    while(a < 29){
        a++;
        cout << "\t"<< setw(2) << a;
        cout << " ";
    }
    cout << " " << endl;
   
    cout << "\t" << "30" << endl;
   
   
    return 0;
}




hopefully this will be okay and you will be able to help me!

Thanks for the help also! <3
#4. Posted:
hah09
  • Resident Elite
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
hopefully this is not too off the topic I am asked to do! like I said I am fairly new to this and need some guidance to the right path!
#5. Posted:
Ant
  • TTG Champion
Status: Offline
Joined: Jun 12, 200915Year Member
Posts: 8,515
Reputation Power: 520
Status: Offline
Joined: Jun 12, 200915Year Member
Posts: 8,515
Reputation Power: 520
hah09 wrote Design and implement a program that outputs the calendar for the month in the following
format:
M T W Th F S Su
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


Would you be able to show a screenshot of your assignment specification? I'm not sure that this is formatted correctly in the post. There are eight numbers on the first line, six on the next three and then four on the last line. Remember there are seven days in a week lol.

Are you sure they aren't looking for something like this?

[ Register or Signin to view external links. ]
#6. Posted:
hah09
  • Resident Elite
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
It is like what you have done! its when I c/p'd it it messed up! the only thing I dont get is the input part of the question!

Thanks for the response!
#7. Posted:
-Deano
  • Rated Awesome
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
Status: Offline
Joined: Aug 19, 201014Year Member
Posts: 5,243
Reputation Power: 532
hah09 wrote It is like what you have done! its when I c/p'd it it messed up! the only thing I dont get is the input part of the question!

Thanks for the response!


The input part is asking you which day is the start of the month.

If you enter "Monday", for example, the calendar will fill out the entire month starting from the Monday slot.
This should change based on what the user enters and should fill up the entirety of the month.
#8. Posted:
hah09
  • Resident Elite
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
Status: Offline
Joined: Mar 07, 201014Year Member
Posts: 247
Reputation Power: 11
yeah basically you choose a month it starts on for example Monday there is 7 days in that but if i choose a Tuesday there is only 6, so what it needs to do is when it gets to the end of the line it ends and carries on if it makes sense. hopefully someone will be able to do it quite soon because it is kinda urgent and i really need to get this done!

Thanks for everything!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.