the questions I have about this program are; what does key word string mean and how is it used in this program? can someone break this down and explain this ? MUCH APPRECIATED!
-ryan
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string dayOfWeek;////////?
int birthYear;
int birthMonth;
int birthDay;
int total = 0;
The "string" contains a string of characters, and in the sample program it is used to hold the day of the week the user is born on and print it on the console.
An if() statement isn't always necessarily followed by an else / else if. An else / else if will only execute if the previous conditions are not met, and in this case, it is not needed.
Modulo (%) is the sign for remainder. i.e. 5 % 2 = 1, because there is a remainder of 1. This can be useful for checking if a number is even or not - i.e. n % 2 returns 0 if it is even, 1 if it is odd.
1) Don't use caps.
2) Use [code] tags.
3) Its not difficult at all. Simply part of paying attention in class. Plus, there are hundreds of online references to help you out.
4) There is no such thing as a keyword called string.
5) There is however a STL container called string inside of the std:: namespace.
6) If you can't figure out the processing part on your own, you need to get out of the class and probably go back to middle school since this is basic algebra with variables. The smallest amount of studying would help you with any syntax that you aren't sure about.