473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Structs in C++ using prototypes from the beginning

First week of the current trimester and we've taken a huge leap from writing little code snippets of loops and switches to writing an entire program, and expecting it to work!
I, nor anyone else in my class have heard of structs which is our first assignment. I've been pounding away for several days now and it won't compile beyond my struct declaration. Anyone who knows a bit about C++ I would enjoy you pointing out all of the syntax and logical errors in the first dozen lines of what is over 100 lines of code so far on this program. Here is the guideline:

CIS 247: Programming Assignment #1

Worth 5 Points Assigned: Week 1 Due: Week 3

You have contracted with a media company that deals with CDs, books, movies and video games and will be helping them manage inventory for one of the types of media.

Create a program that will internally store at least eight media items. Use a global (declared above main() ) structure called book, cd, movie or videoGame. Include at least five member variables (select the appropriate data types) to represent different attributes of a media (some examples: pages, cost, runningTime, format, hardcover, genre, …, etc.).
● One of them has to be price, because I will have you calculate tax (rate 8.5%) and total cost.
● One has to be a char array (C-String) and
● One has to be a char that is an abbreviation (such as r for Red). You select anything for the other two.

In main(), create 6 global month structure variables to represent the six different media items. For example, a structure for a shirt inventory might be:

struct shirt {
char size; // S, M, L, X;
char brand[15]; // uses C-style strings instead of string objects
bool shortSleeve;
char color; // for the required switch statement (r=Red, u=Blue, g=Green, w=White, b=Black, y=Yellow)
double price;
};

Note: The above code is an example, not to be used verbatim. Please choose your own set of variable names and data. You may use similar names. The structure can have the variables in any order.

You can load the data into the structures at the time of declaration, or read from a file.
struct shirt concert={'M', “Hanes”, true, ‘b’, 12.5}; // this would be shirt number 1
struct shirt work={'L', “Sears”, false, ‘u’, 21.95}; // this would be shirt number 2

… // shirt number 7
… // shirt number 8

Note: Select only one media type, come up with your own naming for the variables and use your own (unique) data.

Write a program that will generate a report showing all of the six media items (I'm using shirts instead here). Requirements:

● Create a text menu using a switch() block, to ask for media number, or 0 for all of them, or 99 to exit. All other input will result in an error message.
● Write one function that accepts media number as an int (1-8) and prints the appropriate media package information (see Sample Output), by passing the appropriate media to the function as a parameter. It will use the switch() statement to display the appropriate color (or whatever you want to use as a coded item),

I will be using the following key for color of shirt: (r=Red, u=Blue, g=Green, w=White, b=Black, y=Yellow)

Sample Output - Show output for at least 4 of the 6 items in your inventory
Shirt Menu

Please Enter 1-8 to list the shirts
Please Enter 0 to list all shirts
Please Enter 99 to end the program
Selection: 2

You have chosen to display information on the Sears shirt:
Size: L
Long Sleeve
Color: Blue
Price: $21.95
Tax: $ 1.87
Total Cost: $23.82

Note that the output will depend upon the type of media (not shirt) and variables that you select.

Now, I've given a great deal of effort into the code you are going to be looking at so keep in mind 6 months ago I had never stroked one key of code.
I'm not sure I'm posting this in the right area either, if not someone please direct me to the C++ posting threads please.



//Assignment One CIS247 Joseph Matzke
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

struct movie
{
string rating; //G,PG,PG13,R17,X,XXX
char title; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
bool releaseDate; //Still in theatre-released
char language;//English, Spanish, Japanese, Chinese, German, Swaheely
double cost [2];
double tax;
};
void playMovie (struct movie); //it will not compile beyond here
int main(void)
{
int choice = 0;
//movie anyMovie; //declaration-creates object?
struct movie1={"R17", "Oceans 13", true, 'E', 19.99}; //movie number 1
movie movie2={"R17", "Oceans 12", false, 'E', 9.99};
movie movie3={"R17", "Oceans 11", false, 'E', 9.99);
movie movie4={"R17", "Braveheart", false, 'E', 9.99};
movie movie5={"PG", "Harry Potter", false, 'E', 9.99};
movie movie6={"XXX", "Caligula", false, 'S', 1.99};

system ("pause");
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";

There is a lot more code to this, my switch module, my array, and so on but they do me no good if I can't compile beyond where I've noted.
I've changed from --void main (void) to--int main()--to int main (void)-- and regardless of what I do, actually my original code did not have a return in the main but the compiler message seemed to want me to return an int. Can anyone spot the problem? Thanks
Jul 21 '07 #1
38 2993
ilikepython
844 Expert 512MB
First week of the current trimester and we've taken a huge leap from writing little code snippets of loops and switches to writing an entire program, and expecting it to work!
I, nor anyone else in my class have heard of structs which is our first assignment. I've been pounding away for several days now and it won't compile beyond my struct declaration. Anyone who knows a bit about C++ I would enjoy you pointing out all of the syntax and logical errors in the first dozen lines of what is over 100 lines of code so far on this program. Here is the guideline:

CIS 247: Programming Assignment #1

Worth 5 Points Assigned: Week 1 Due: Week 3

You have contracted with a media company that deals with CDs, books, movies and video games and will be helping them manage inventory for one of the types of media.

Create a program that will internally store at least eight media items. Use a global (declared above main() ) structure called book, cd, movie or videoGame. Include at least five member variables (select the appropriate data types) to represent different attributes of a media (some examples: pages, cost, runningTime, format, hardcover, genre, …, etc.).
● One of them has to be price, because I will have you calculate tax (rate 8.5%) and total cost.
● One has to be a char array (C-String) and
● One has to be a char that is an abbreviation (such as r for Red). You select anything for the other two.

In main(), create 6 global month structure variables to represent the six different media items. For example, a structure for a shirt inventory might be:

struct shirt {
char size; // S, M, L, X;
char brand[15]; // uses C-style strings instead of string objects
bool shortSleeve;
char color; // for the required switch statement (r=Red, u=Blue, g=Green, w=White, b=Black, y=Yellow)
double price;
};

Note: The above code is an example, not to be used verbatim. Please choose your own set of variable names and data. You may use similar names. The structure can have the variables in any order.

You can load the data into the structures at the time of declaration, or read from a file.
struct shirt concert={'M', “Hanes”, true, ‘b’, 12.5}; // this would be shirt number 1
struct shirt work={'L', “Sears”, false, ‘u’, 21.95}; // this would be shirt number 2

… // shirt number 7
… // shirt number 8

Note: Select only one media type, come up with your own naming for the variables and use your own (unique) data.

Write a program that will generate a report showing all of the six media items (I'm using shirts instead here). Requirements:

● Create a text menu using a switch() block, to ask for media number, or 0 for all of them, or 99 to exit. All other input will result in an error message.
● Write one function that accepts media number as an int (1-8) and prints the appropriate media package information (see Sample Output), by passing the appropriate media to the function as a parameter. It will use the switch() statement to display the appropriate color (or whatever you want to use as a coded item),

I will be using the following key for color of shirt: (r=Red, u=Blue, g=Green, w=White, b=Black, y=Yellow)

Sample Output - Show output for at least 4 of the 6 items in your inventory
Shirt Menu

Please Enter 1-8 to list the shirts
Please Enter 0 to list all shirts
Please Enter 99 to end the program
Selection: 2

You have chosen to display information on the Sears shirt:
Size: L
Long Sleeve
Color: Blue
Price: $21.95
Tax: $ 1.87
Total Cost: $23.82

Note that the output will depend upon the type of media (not shirt) and variables that you select.

Now, I've given a great deal of effort into the code you are going to be looking at so keep in mind 6 months ago I had never stroked one key of code.
I'm not sure I'm posting this in the right area either, if not someone please direct me to the C++ posting threads please.



//Assignment One CIS247 Joseph Matzke
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

struct movie
{
string rating; //G,PG,PG13,R17,X,XXX
char title; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
bool releaseDate; //Still in theatre-released
char language;//English, Spanish, Japanese, Chinese, German, Swaheely
double cost [2];
double tax;
};
void playMovie (struct movie); //it will not compile beyond here
int main(void)
{
int choice = 0;
//movie anyMovie; //declaration-creates object?
struct movie1={"R17", "Oceans 13", true, 'E', 19.99}; //movie number 1
movie movie2={"R17", "Oceans 12", false, 'E', 9.99};
movie movie3={"R17", "Oceans 11", false, 'E', 9.99);
movie movie4={"R17", "Braveheart", false, 'E', 9.99};
movie movie5={"PG", "Harry Potter", false, 'E', 9.99};
movie movie6={"XXX", "Caligula", false, 'S', 1.99};

system ("pause");
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";

There is a lot more code to this, my switch module, my array, and so on but they do me no good if I can't compile beyond where I've noted.
I've changed from --void main (void) to--int main()--to int main (void)-- and regardless of what I do, actually my original code did not have a return in the main but the compiler message seemed to want me to return an int. Can anyone spot the problem? Thanks
Try making the prototype this:
Expand|Select|Wrap|Line Numbers
  1. void playMovie(movie movie_a);
  2.  
And also in your struct you have title and language as a char, which means they can store one char (letter). Shouldn't they be char pointers?
Jul 21 '07 #2
Hey, I hadn't even noticed that and apparently the compiler didn't either. Your right, one is a required string that I declared wrong==I'm working on it. Been reading about structs and objects, basically they are a parent file and a child, or main and sub file creating a variable of definable attributes rather than simply a primitive variable such as int x.
Thank you for your help, I have 10 days left to finish this code and I am more than certain I'm going to run into more problems and will be asking again for a shove in the right direction.
Thank You
Joe
Jul 22 '07 #3
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";
cin >> choice >> endl;
cout << endl; << endl;
}
while choice !=99);

{
cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
}

playMovie (show movie);

cout << "Choose a movie by entering 1 thru 6" << endl;
cin >> choice;

switch (movie)
{
case '1': movie1 = "Oceans 13 / NEW";


OK, I think I have enough time in trying to figure out why other code I have written using a do while has worked like this, and this will not, whether I move the brace and include this in the main, or swap another module between this the compiler error keeps coming up
"unqualified id before do" or expected 'or' before 'do', what are they talking about expected >or< before do? I've never heard that-
If anyone knows where the syntax error is please feel free, it compiles through my do while now. I actually don't really see a whole lot of use for a do while other than it's a required part of the program, seems to me you can use a 'for' loop, an 'if' statement in any case avoiding these problems with this compiling. Unless I guess you for some reason had to have a post test or a pre-test loop that I can't think of. OK Here's my problem-
Jul 22 '07 #4
ilikepython
844 Expert 512MB
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";
cin >> choice >> endl;
cout << endl; << endl;
}
while choice !=99);

{
cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
}

playMovie (show movie);

cout << "Choose a movie by entering 1 thru 6" << endl;
cin >> choice;

switch (movie)
{
case '1': movie1 = "Oceans 13 / NEW";


OK, I think I have enough time in trying to figure out why other code I have written using a do while has worked like this, and this will not, whether I move the brace and include this in the main, or swap another module between this the compiler error keeps coming up
"unqualified id before do" or expected 'or' before 'do', what are they talking about expected >or< before do? I've never heard that-
If anyone knows where the syntax error is please feel free, it compiles through my do while now. I actually don't really see a whole lot of use for a do while other than it's a required part of the program, seems to me you can use a 'for' loop, an 'if' statement in any case avoiding these problems with this compiling. Unless I guess you for some reason had to have a post test or a pre-test loop that I can't think of. OK Here's my problem-
Is your do while in a function? If it is in the middle of a source file, the compiler will generate an error. If it isn't, check your braces. If you put an extra one the compiler will think the function has ended and give an error for the do while.

You can't include loops or ifs outside of functions. However, you can declare variables, as you probably have been doing.
Jul 22 '07 #5
Nope, actually I don't know what I'm doing. I thought it would be easiest for me to create an IPO chart and start writing out all the modules, then edit them as I compiled down the line. I've written most of them, my array I need to figure out yet but--nothing compiles. The change I made to my struct did get it to compile down several more lines, but I don't know why so that isn't doing me much good. Why,
void playMovie (movie) to void playMovie (movie movie_a) made the difference I don't have a clue.
I've also been changing my struct declarations from reading other posts in here and it's simply making it more confusing. Here's the whole code so far, changed 117 times mind you, but it is just the starting modules as I said--I thought I would be able to compile through the errors one at a time but it's really getting out of hand now.


//Assignment One CIS247 Joseph Matzke
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

struct movie
{
char movie; //G,PG,PG13,R17,X
char title; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
bool releaseDate; //Still in theatre-released
char language[];//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
double cost;
double tax;
};
void playMovie (struct movie movie_a);
int main(void)
{
int choice = 0;
//movie anyMovie; //declaration-creates object?
movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
movie movie2={'R', "Oceans 12", false, 'E', 9.99};
movie movie3={'R', "Oceans 11", false, 'E', 9.99};
movie movie4={'R', "Braveheart", false, 'E', 9.99};
movie movie5={'G', "Harry Potter", false, 'E', 9.99};
movie movie6={'X', "Caligula", false, 'S', 1.99};

system ("pause");
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";
cin >> choice >> endl;
cout << endl; << endl;
}
while choice !=99);

{
cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
}

playMovie (show movie);

cout << "Choose a movie by entering 1 thru 6" << endl;
cin >> choice;

switch (movie)
{
case '1': movie1 = "Oceans 13 / NEW";
break;
case '2': movie2 = "Oceans 12 /released";
break;
case '3': movie3 = "Oceans 11 /released";
break;
case '4': movie4 = "Braveheart /released";
break;
case '5': movie5 = "Harry Potter /released";
break;
case '6': movie6 = "Caligula /released";
default: movie = "Invalid selection";
}



void playMovie (show movie)
{
double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
double choice [] = {0,0,0,0,0,0};

cout << "Enter movie choice" << endl;
cin >> choice[];
}
{
if (choice == 1);
cout << "movie[0]" << endl;
else
if (choice =>2 && < 6);
cout << "movie[2]" << endl;
else cout << "movie[5]" << endl;
}

movie (cost)
{
if (movie == 1)
cout << "Cost is 19.99:" << endl;
else if (movie =>1 && < 6);
cout << "Cost is 9.99:" << endl;
else
cout << "Cost is 1.99:" << endl;
}
total (cost)
{
if (movie == 1)
cost = 19.99 * .08;
cout >> cost;
else if (movie =>2 && < 6);
cost = 9.99 * .08;
cout << cost;
else cost = 1.99 * .08;
cout << cost;
return cost;
}

cout << "You have picked movie " << movie << "your cost is " << cost << endl;




Any suggestions, scrap this entire thing, start over using a different approach? I'm getting truly frustrated HERE!!!!!
Jul 22 '07 #6
Nope, actually I don't know what I'm doing. I thought it would be easiest for me to create an IPO chart and start writing out all the modules, then edit them as I compiled down the line. I've written most of them, my array I need to figure out yet but--nothing compiles. The change I made to my struct did get it to compile down several more lines, but I don't know why so that isn't doing me much good. Why,
void playMovie (movie) to void playMovie (movie movie_a) made the difference I don't have a clue.
I've also been changing my struct declarations from reading other posts in here and it's simply making it more confusing. Here's the whole code so far, changed 117 times mind you, but it is just the starting modules as I said--I thought I would be able to compile through the errors one at a time but it's really getting out of hand now.


Expand|Select|Wrap|Line Numbers
  1. //Assignment One CIS247 Joseph Matzke
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct movie
  9. {
  10.        char movie; //G,PG,PG13,R17,X
  11.        char title; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  12.        bool releaseDate; //Still in theatre-released
  13.        char language[];//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  14.        double cost; 
  15.        double tax;
  16. };
  17. void playMovie (struct movie movie_a);
  18. int main(void)
  19. {
  20.     int choice = 0;
  21.     //movie anyMovie;  //declaration-creates object?
  22.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  23.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  24.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  25.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  26.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  27.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  28.  
  29.     system ("pause");
  30.     return 0;
  31. }
  32.  
  33.    do  
  34.    {
  35.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  36.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  37.        cout << "Selection:  ";
  38.        cin >> choice >> endl;
  39.        cout << endl; << endl;
  40.    }
  41.        while choice !=99);
  42.  
  43.   {     
  44.        cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
  45.        cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
  46.        cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
  47.   }         
  48.  
  49. playMovie (show movie);
  50.  
  51. cout << "Choose a movie by entering 1 thru 6" << endl;
  52. cin >> choice;
  53.  
  54. switch (movie)
  55. {
  56.     case '1': movie1 = "Oceans 13 / NEW";
  57.     break;
  58.     case '2': movie2 = "Oceans 12 /released"; 
  59.     break;
  60.     case '3': movie3 = "Oceans 11 /released";
  61.     break;
  62.     case '4': movie4 = "Braveheart /released";
  63.     break;
  64.     case '5': movie5 = "Harry Potter /released";
  65.     break;
  66.     case '6': movie6 = "Caligula /released";
  67.     default: movie = "Invalid selection";
  68. }
  69.  
  70.  
  71.  
  72.   void playMovie (show movie)
  73.   {
  74.        double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
  75.        double choice [] = {0,0,0,0,0,0};
  76.  
  77.        cout << "Enter movie choice" << endl;
  78.        cin >> choice[];
  79.   }
  80.   {
  81.        if (choice == 1);
  82.        cout << "movie[0]" << endl;
  83.          else 
  84.            if (choice =>2 && < 6);
  85.            cout << "movie[2]" << endl;
  86.              else cout << "movie[5]" << endl;
  87.   }
  88.  
  89.        movie (cost)
  90.        {
  91.              if (movie == 1)
  92.              cout << "Cost is 19.99:" << endl;
  93.              else if (movie =>1 && < 6);
  94.              cout << "Cost is 9.99:" << endl;
  95.              else 
  96.              cout << "Cost is 1.99:" << endl;
  97.        }
  98.        total (cost)
  99.        {
  100.        if (movie == 1)
  101.        cost = 19.99 * .08;
  102.        cout >> cost;
  103.        else if (movie =>2 && < 6);
  104.        cost = 9.99 * .08;
  105.        cout << cost;
  106.        else cost = 1.99 * .08;
  107.        cout << cost;
  108.        return cost;
  109.        }
  110.  
  111.        cout << "You have picked movie " << movie << "your cost is " << cost << endl;



Any suggestions, scrap this entire thing, start over using a different approach? I'm getting truly frustrated HERE!!!!!
Your forgot a ( in your while statement at the end of your do loop.
Jul 22 '07 #7
ilikepython
844 Expert 512MB
Nope, actually I don't know what I'm doing. I thought it would be easiest for me to create an IPO chart and start writing out all the modules, then edit them as I compiled down the line. I've written most of them, my array I need to figure out yet but--nothing compiles. The change I made to my struct did get it to compile down several more lines, but I don't know why so that isn't doing me much good. Why,
void playMovie (movie) to void playMovie (movie movie_a) made the difference I don't have a clue.
I've also been changing my struct declarations from reading other posts in here and it's simply making it more confusing. Here's the whole code so far, changed 117 times mind you, but it is just the starting modules as I said--I thought I would be able to compile through the errors one at a time but it's really getting out of hand now.


//Assignment One CIS247 Joseph Matzke
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;

struct movie
{
char movie; //G,PG,PG13,R17,X
char title; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
bool releaseDate; //Still in theatre-released
char language[];//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
double cost;
double tax;
};
void playMovie (struct movie movie_a);
int main(void)
{
int choice = 0;
//movie anyMovie; //declaration-creates object?
movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
movie movie2={'R', "Oceans 12", false, 'E', 9.99};
movie movie3={'R', "Oceans 11", false, 'E', 9.99};
movie movie4={'R', "Braveheart", false, 'E', 9.99};
movie movie5={'G', "Harry Potter", false, 'E', 9.99};
movie movie6={'X', "Caligula", false, 'S', 1.99};

system ("pause");
return 0;
}

do
{
cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
cout << "Selection: ";
cin >> choice >> endl;
cout << endl; << endl;
}
while choice !=99);

{
cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
}

playMovie (show movie);

cout << "Choose a movie by entering 1 thru 6" << endl;
cin >> choice;

switch (movie)
{
case '1': movie1 = "Oceans 13 / NEW";
break;
case '2': movie2 = "Oceans 12 /released";
break;
case '3': movie3 = "Oceans 11 /released";
break;
case '4': movie4 = "Braveheart /released";
break;
case '5': movie5 = "Harry Potter /released";
break;
case '6': movie6 = "Caligula /released";
default: movie = "Invalid selection";
}



void playMovie (show movie)
{
double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
double choice [] = {0,0,0,0,0,0};

cout << "Enter movie choice" << endl;
cin >> choice[];
}
{
if (choice == 1);
cout << "movie[0]" << endl;
else
if (choice =>2 && < 6);
cout << "movie[2]" << endl;
else cout << "movie[5]" << endl;
}

movie (cost)
{
if (movie == 1)
cout << "Cost is 19.99:" << endl;
else if (movie =>1 && < 6);
cout << "Cost is 9.99:" << endl;
else
cout << "Cost is 1.99:" << endl;
}
total (cost)
{
if (movie == 1)
cost = 19.99 * .08;
cout >> cost;
else if (movie =>2 && < 6);
cost = 9.99 * .08;
cout << cost;
else cost = 1.99 * .08;
cout << cost;
return cost;
}

cout << "You have picked movie " << movie << "your cost is " << cost << endl;




Any suggestions, scrap this entire thing, start over using a different approach? I'm getting truly frustrated HERE!!!!!
Ok, first of all you need to relax, don't get so frustrated.

First of all, you don't need to write struct in front of the struct name in the prototype:
Expand|Select|Wrap|Line Numbers
  1. void playMovie(movie);
  2.  
should work.
Expand|Select|Wrap|Line Numbers
  1. int main(void)
  2. {
  3.     int choice = 0;
  4.     //movie anyMovie;  //declaration-creates object?
  5.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  6.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  7.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  8.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  9.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  10.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  11.  
  12.     system ("pause");
  13.     return 0;
  14. }
  15.  
Ok, so you declared your movies, but you ended main and continued writing the program outside a function! That's probably the cause of most of your errors.

continuing main...
Expand|Select|Wrap|Line Numbers
  1.  do  
  2.    {
  3.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  4.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  5.        cout << "Selection:  ";
  6.        cin >> choice >> endl;
  7.        cout << endl; << endl;
  8.    }
  9.        while choice !=99);
  10.  
  11.   {     
  12.        cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
  13.        cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
  14.        cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
  15.   }         
  16.  
Your do while loop is a bit confusing. Is this what you were looking for:
Expand|Select|Wrap|Line Numbers
  1. do
  2. {
  3.     cout << "Please enter 0 to list all movies" << endl;
  4.     cout << "Please enter 99 to exit program" << endl;   
  5.     cout << "Selection: ";
  6.     cin >> choice;
  7. }
  8. while( choice != 0 && choice != 99);   // go back if choice not 0 or 99
  9.  
  10. if (choice == 99)
  11. {
  12.     return 0;        // exit prgoram
  13. }
  14.  
  15. if (choice == 0)
  16. {
  17.     cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
  18.        cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
  19.        cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
  20. }
  21.  
So far so good.
Expand|Select|Wrap|Line Numbers
  1. playMovie (show movie);     // invalid syntax
  2.  
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cin >> choice;
  5.  
  6. switch (movie)
  7. {
  8.     case '1': movie1 = "Oceans 13 / NEW";
  9.     break;
  10.     case '2': movie2 = "Oceans 12 /released"; 
  11.     break;
  12.     case '3': movie3 = "Oceans 11 /released";
  13.     break;
  14.     case '4': movie4 = "Braveheart /released";
  15.     break;
  16.     case '5': movie5 = "Harry Potter /released";
  17.     break;
  18.     case '6': movie6 = "Caligula /released";
  19.     default: movie = "Invalid selection";
  20. }
  21.  
You never declared movie. Did you mean to put choice in the switch? Is play movie supposed to display everything about the movie (all the variables in the struct)? Try something like this:
Expand|Select|Wrap|Line Numbers
  1. cout << "Choose a movie be entering 1 - 6" << endl;
  2. cout << "Selection: ";
  3. cin >> choice;
  4.  
  5. movie *pmovie; = NULL;   // pointer to movie that user chooses
  6.  
  7. switch (choice)
  8. {
  9.     case 1:
  10.         pmovie = &movie1;
  11.         break;
  12.     case 2:
  13.         pmovie = &movie2;
  14.         break;
  15.     case 3:
  16.         pmovie = &movie3;
  17.         break;
  18.     case 4:
  19.         pmovie = &movie4;
  20.         break;
  21.     case 5:
  22.         pmovie = &movie5;
  23.         break;
  24.     case 6:
  25.         pmovie = &movie6;
  26.         break;
  27. }
  28.  
  29. if (pmovie != NULL)
  30. {
  31.     playMovie(*pmovie);
  32. }
  33.  
Try to correct playMovie yourself and come here if you have any questions. Also, if you don't understand anything just ask.

PS. Please use code tags, it makes your code easier to read and understand.
Jul 22 '07 #8
OK, thank you for taking the time to explain that all to me!! It is making sense now and is a bit embarrassing some of the glaring errors such as writing outside of the function...........I know that much at least. I am reading all I can on pointers, in here and my text book and it's fairly deep and a bit hard to wrap your head around, but-I am determined to get this thing nailed down and understood.
I was wondering why he was giving us two weeks instead of last terms usual two hours, or two days, and I now know why it is taking me that long!
Thanks again python, that was very cool of you to take the time to explain for what I am sure are obvious C++ for DUMMIES mistakes to you.
Joe
Jul 23 '07 #9
Well just to get some things settled I thought I would give it a go to compile and get through just main once to get that great feeling of accomplishment, yet to the detriment of my pc and a bit of abuse to the defenseless mouse I see that very familiar "EXCESS ELEMENTS IN AGGREGATE INITIALIZER"...
I have the same amount of elements in my struct initialized as I have declared which puzzles me, even makes me think it may be my using Dev, rather than that wonderfully helpful VS edition I've installed that came with our software bundle. However nobody uses it, because it is such a crappy environment with incomprehensible error messages in keeping with that great Microsoft tradition of over complication. Simplification is the ultimate sophistication should be their corporate mission statement but it's not. Does anyone believe some of my problems would go away if I were to use Visual Studio? Why would it be that an equally amount of declared sub sets in a struct, which is 6, along with the initialized six produces the error message above in upper case?? There is obviously some logic I am not aware of when attempting to create an OOP. I didn't have quite this much trouble with first attempts at any other type of brand new introductions I was given, anyone have some compiler knowledge that can interpret this message for me it would be greatly appreciated.
Joe

Expand|Select|Wrap|Line Numbers
  1.  //Assignment One CIS247 Joseph Matzke
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct movie
  9. {
  10.        char rating; //G,PG,PG13,R17,X
  11.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  12.        bool releaseDate[]; //Still in theatre-released
  13.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  14.        double cost; 
  15.        double tax;
  16. };
  17. void playMovie (movie);
  18. int main(void)
  19. {
  20.     int choice = 0;
  21.     //movie anyMovie;  //declaration-creates object?
  22.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  23.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  24.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  25.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  26.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  27.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  28.  
  29.     //system ("pause");
  30.     //return 0;
  31. //}
  32.  
  33.    do  
  34.    {
  35.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  36.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  37.        cout << "Selection:  ";
  38.        cin >> choice >> endl;
  39.        cout << endl; << endl;
  40.    }
  41.        while (choice != 0 && choice !=99);//repeat if choice not 0 or 99
  42.  
  43.        if (choice == 99)
  44.        {
  45.                   system ("pause");
  46.                   return 0;
  47.        }
  48.        if (choice == 0)
  49.  
  50.   {     
  51.        cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
  52.        cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
  53.        cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
  54.   }         
  55.  
  56. playMovie (movie);
  57.  
  58. cout << "Choose a movie by entering 1 thru 6" << endl;
  59. cout << "Selection :";
  60. cin >> choice;
  61.  
  62. movie *pmovie; = NULL;  //pointer to movie that user chooses
  63.  
  64. switch (choice)
  65. {
  66.     case 1:
  67.          pmovie = &movie1;
  68.          break;
  69.     case 2:
  70.          pmovie = &movie2;
  71.          break;
  72.     case 3:
  73.          pmovie = &movie3;
  74.          break;
  75.     case 4:
  76.          pmovie = &movie4;
  77.          break;
  78.     case 5:
  79.          pmovie = &movie5;
  80.          break;
  81.     case 6:
  82.          pmovie = &movie6;
  83.          break;
  84. }
  85.     if (pmovie != NULL)
  86. {
  87.                playMovie (*pmovie);
  88. }
  89.  
  90.  
  91.   void playMovie (releaseDate[])
  92.   {
  93.        double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
  94.        double choice [] = {0,0,0,0,0,0};
  95.  
  96.        cout << "Enter movie choice" << endl;
  97.        cin >> choice[];
  98.   //}
  99.   //{
  100.        if (choice == 1);
  101.        cout << "movie[0]" << endl;
  102.          else 
  103.            if (choice =>2 && < 6);
  104.            cout << "movie[2]" << endl;
  105.              else cout << "movie[5]" << endl;
  106.   }
  107.  
  108.        void playMovie (cost)
  109.        {
  110.              if (movie == 1)
  111.              cout << "Cost is 19.99:" << endl;
  112.              else if (movie =>1 && < 6);
  113.              cout << "Cost is 9.99:" << endl;
  114.              else 
  115.              cout << "Cost is 1.99:" << endl;
  116.        }
  117.        total (cost)
  118.        {
  119.        if (movie == 1)
  120.        cost = 19.99 * .08;
  121.        cout >> cost;
  122.        else if (movie =>2 && < 6);
  123.        cost = 9.99 * .08;
  124.        cout << cost;
  125.        else cost = 1.99 * .08;
  126.        cout << cost;
  127.        return cost;
  128.        }
  129.  
  130.        cout << "You have chosen movie " << *pmovie << "your cost is " << cost << endl; 
Jul 23 '07 #10
Oh, now that I'm catching on to how to post correctly here for ease of discussion it is line 22 that the compiler is spitting out that message to me on.
Who wrote this shell? Very cool-
Jul 23 '07 #11
ilikepython
844 Expert 512MB
Well just to get some things settled I thought I would give it a go to compile and get through just main once to get that great feeling of accomplishment, yet to the detriment of my pc and a bit of abuse to the defenseless mouse I see that very familiar "EXCESS ELEMENTS IN AGGREGATE INITIALIZER"...
I have the same amount of elements in my struct initialized as I have declared which puzzles me, even makes me think it may be my using Dev, rather than that wonderfully helpful VS edition I've installed that came with our software bundle. However nobody uses it, because it is such a crappy environment with incomprehensible error messages in keeping with that great Microsoft tradition of over complication. Simplification is the ultimate sophistication should be their corporate mission statement but it's not. Does anyone believe some of my problems would go away if I were to use Visual Studio? Why would it be that an equally amount of declared sub sets in a struct, which is 6, along with the initialized six produces the error message above in upper case?? There is obviously some logic I am not aware of when attempting to create an OOP. I didn't have quite this much trouble with first attempts at any other type of brand new introductions I was given, anyone have some compiler knowledge that can interpret this message for me it would be greatly appreciated.
Joe

Expand|Select|Wrap|Line Numbers
  1.  //Assignment One CIS247 Joseph Matzke
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct movie
  9. {
  10.        char rating; //G,PG,PG13,R17,X
  11.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  12.        bool releaseDate[]; //Still in theatre-released
  13.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  14.        double cost; 
  15.        double tax;
  16. };
  17. void playMovie (movie);
  18. int main(void)
  19. {
  20.     int choice = 0;
  21.     //movie anyMovie;  //declaration-creates object?
  22.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  23.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  24.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  25.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  26.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  27.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  28.  
  29.     //system ("pause");
  30.     //return 0;
  31. //}
  32.  
  33.    do  
  34.    {
  35.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  36.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  37.        cout << "Selection:  ";
  38.        cin >> choice >> endl;
  39.        cout << endl; << endl;
  40.    }
  41.        while (choice != 0 && choice !=99);//repeat if choice not 0 or 99
  42.  
  43.        if (choice == 99)
  44.        {
  45.                   system ("pause");
  46.                   return 0;
  47.        }
  48.        if (choice == 0)
  49.  
  50.   {     
  51.        cout << setw(12) << "Oceans 13" << endl; << "Oceans 12" << endl; "Oceans 11" << endl;
  52.        cout << "Braveheart" << endl; << "Harry Potter" << endl; << "Caligula" << endl;
  53.        cout << setw(12) << "movie1" << "movie2" << "movie3" << "movie4" << "movie5" << "movie6" << endl;
  54.   }         
  55.  
  56. playMovie (movie);
  57.  
  58. cout << "Choose a movie by entering 1 thru 6" << endl;
  59. cout << "Selection :";
  60. cin >> choice;
  61.  
  62. movie *pmovie; = NULL;  //pointer to movie that user chooses
  63.  
  64. switch (choice)
  65. {
  66.     case 1:
  67.          pmovie = &movie1;
  68.          break;
  69.     case 2:
  70.          pmovie = &movie2;
  71.          break;
  72.     case 3:
  73.          pmovie = &movie3;
  74.          break;
  75.     case 4:
  76.          pmovie = &movie4;
  77.          break;
  78.     case 5:
  79.          pmovie = &movie5;
  80.          break;
  81.     case 6:
  82.          pmovie = &movie6;
  83.          break;
  84. }
  85.     if (pmovie != NULL)
  86. {
  87.                playMovie (*pmovie);
  88. }
  89.  
  90.  
  91.   void playMovie (releaseDate[])
  92.   {
  93.        double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
  94.        double choice [] = {0,0,0,0,0,0};
  95.  
  96.        cout << "Enter movie choice" << endl;
  97.        cin >> choice[];
  98.   //}
  99.   //{
  100.        if (choice == 1);
  101.        cout << "movie[0]" << endl;
  102.          else 
  103.            if (choice =>2 && < 6);
  104.            cout << "movie[2]" << endl;
  105.              else cout << "movie[5]" << endl;
  106.   }
  107.  
  108.        void playMovie (cost)
  109.        {
  110.              if (movie == 1)
  111.              cout << "Cost is 19.99:" << endl;
  112.              else if (movie =>1 && < 6);
  113.              cout << "Cost is 9.99:" << endl;
  114.              else 
  115.              cout << "Cost is 1.99:" << endl;
  116.        }
  117.        total (cost)
  118.        {
  119.        if (movie == 1)
  120.        cost = 19.99 * .08;
  121.        cout >> cost;
  122.        else if (movie =>2 && < 6);
  123.        cost = 9.99 * .08;
  124.        cout << cost;
  125.        else cost = 1.99 * .08;
  126.        cout << cost;
  127.        return cost;
  128.        }
  129.  
  130.        cout << "You have chosen movie " << *pmovie << "your cost is " << cost << endl; 
Let's sse your struct:
Expand|Select|Wrap|Line Numbers
  1. struct movie
  2. {
  3.        char rating; //G,PG,PG13,R17,X
  4.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  5.        bool releaseDate[]; //Still in theatre-released
  6.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  7.        double cost; 
  8.        double tax;
  9. };
  10.  
releaseDate is an array of bools, you are giving it a bool when declaring your movies. I assume you only need 1 bool, so take off the square brackets, and those errors will dissapear (I tried it).
If you want an array you have to put a number in the brackets.
Jul 23 '07 #12
ilikepython
844 Expert 512MB
Let's sse your struct:
Expand|Select|Wrap|Line Numbers
  1. struct movie
  2. {
  3.        char rating; //G,PG,PG13,R17,X
  4.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  5.        bool releaseDate[]; //Still in theatre-released
  6.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  7.        double cost; 
  8.        double tax;
  9. };
  10.  
releaseDate is an array of bools, you are giving it a bool when declaring your movies. I assume you only need 1 bool, so take off the square brackets, and those errors will dissapear (I tried it).
If you want an array you have to put a number in the brackets.
Well, apperantly my post didn't show up but if you click reply you can see what I wrote.

Edit: Well, it shows up in the quotes so that's kind of wierd. I've seen it happen to other people too.
Jul 23 '07 #13
Got it, I'm down to line beyond main now and it's exciting. I found some pages where you can get some explanation of compiler error messages at

http://www.csee.umbc.edu/courses/undergraduate/341/misc/CommonErrors.shtml

but it doesn't contain what I am looking for. In particular I am looking for "expected primary-expression before '<<' token", and am going to keep on looking!

The pointers I have some questions on but from what I've read, and what is contained in the program once the syntax errors are gone and I can see the output I'm sure I'll be able to play with it and get a much better feel for what I do understand and what I don't understand--so for now I'll not ask redundant questions that may or may not be answered once I get this thing to compile.
Using an array for a bool is, pretty dumb now that I'm looking at it. It was really a short cut to get my required array in the program, but if I'm going to use an array I might as well use it for what it's intended for as in my movie titles or some other menu type deal, that way I think I could use a char memory allocation for my string titles and cut down on memory use. I'm actually going to change a bunch of things if I could get some output to dislike.
Thank you for your help, when I get truly stuck again I'll be back, which means to say probably in a few hours-).
Thanks Python
Jul 23 '07 #14
Ahh, I am soo used to the error being on the line prior this is truly embarrassing. After changing every ; << and { in the first 50 lines I realized the line itself contained the error.
This will cause an error: cout << setw(12) << "Money" << endl; << "Braveheart" << endl; cout << "..." << endl;

I can see that running your code in one big long line is very dangerous for the chance of having errors that are not very obvious, such as missing a cout.

Unbelievable. OK, I'm getting there.
Jul 24 '07 #15
Alright, I'm progressing slowly. My output is not quite what I thought it was going to be. I was looking to justify right the title and on the same line right justify the equivalent movie number.

"Oceans 13" movie1
"Oceans 12" movie2

and so on.......How do you do this, I must need to create a tab inline or something. This isn't required, nor have I ever seen it done, actually the setw() was something I saw in some code here. Do I need to move the output all on one cout like this if I want the output to appear as it does above?

cout << setw(4) << "Oceans 13" << setw(12) << movie1 << endl;

Would I need to rewrite it all something like this to create this or is there some other way to tab 'movie1' on to the same line. I might be getting a little out of my league since this is really my first sort of real program. I don't know, getting tired though.
Is there any short cut commands to make this occur? Thanks

Expand|Select|Wrap|Line Numbers
  1.  //Assignment One CIS247 Joseph Matzke
  2. #include <cstdlib>
  3. #include <iomanip>
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. struct movie
  9. {
  10.        char rating; //G,PG,PG13,R17,X
  11.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  12.        bool releaseDate; //Still in theatre-released
  13.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  14.        double cost[5]; 
  15.        double tax;
  16. };
  17. void playMovie (movie);
  18. int main(void)
  19. {
  20.     int choice = 0;
  21.     //movie anyMovie;  //declaration-creates object?
  22.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  23.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  24.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  25.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  26.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  27.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  28.  
  29.  
  30.    do  
  31.    {
  32.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  33.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  34.        cout << "Selection:  ";
  35.        cin >> choice;
  36.        //cout << endl; << endl;
  37.    }
  38.        while (choice != 0 && choice !=99);//repeat if choice not 0 or 99
  39.  
  40.        if (choice == 99)
  41.    {
  42.                   system ("pause");
  43.                   return 0;
  44.    }
  45.  
  46.  
  47.        if (choice == 0)
  48.  
  49.  
  50.   {     
  51.        cout << setw(4) << "Oceans 13" << endl; 
  52.        cout << setw(4) << "Oceans 12" << endl; 
  53.        cout << setw(4) << "Oceans 11" << endl;
  54.        cout << setw(4) << "Braveheart" << endl; 
  55.        cout << setw(4) <<"Harry Potter" << endl;
  56.        cout << setw(4) << "Caligula" << endl;
  57.        cout << setw(12) << "movie1" << endl; 
  58.        cout << setw(12) << "movie2" << endl; 
  59.        cout << setw(12) << "movie3" << endl;
  60.        cout << setw(12) << "movie4" << endl; 
  61.        cout << setw(12) << "movie5" << endl; 
  62.        cout << setw(12) << "movie6" << endl;
  63.   }   
  64.   system ("pause");
  65.   return 0;      
  66. }         
As you can see I had to change it ALL, I didn't like the way it looked, at all.

If there's anyway I'd appreciate it.
Joe
Jul 24 '07 #16
ilikepython
844 Expert 512MB
Alright, I'm progressing slowly. My output is not quite what I thought it was going to be. I was looking to justify right the title and on the same line right justify the equivalent movie number.

"Oceans 13" movie1
"Oceans 12" movie2

and so on.......How do you do this, I must need to create a tab inline or something. This isn't required, nor have I ever seen it done, actually the setw() was something I saw in some code here. Do I need to move the output all on one cout like this if I want the output to appear as it does above?

cout << setw(4) << "Oceans 13" << setw(12) << movie1 << endl;

Would I need to rewrite it all something like this to create this or is there some other way to tab 'movie1' on to the same line. I might be getting a little out of my league since this is really my first sort of real program. I don't know, getting tired though.
Is there any short cut commands to make this occur? Thanks

As you can see I had to change it ALL, I didn't like the way it looked, at all.

If there's anyway I'd appreciate it.
Joe
Maybe "\t" (tab) could do what you need:
Expand|Select|Wrap|Line Numbers
  1. cout << movie1.movie << "\t" << "movie1" << endl; // not good to have literal, use the actual variable
  2. cout << movie2.movie << "\t" << "movie2" << endl;
  3. etc...
  4.  
Does that work for you?
Jul 24 '07 #17
VRX, if you think I would know how to write that code assignment you're crazy! This is the first 'real' program I have ever tried to write myself. If you wrote some code I might see some things wrong? I have 6 days left to finish this one and I'm going backwards. I thought you were explaining to me how to approach writing a program when I started reading your posting-)
No, I wrote "Hello World" 3 months ago so I'm not the one to ask. If you thought you were posting your own thread, you were not: You simply tagged on to mine. Good luck, I know the feeling.

On to my little project that is getting there, slowly but getting there. I've decided it's easier to just write out my initial cout's as this:

cout << "Braveheart" << movie4 << endl; in order to bring the variable name to the same line as the title. The console manipulation is too advanced and I don't have the time.
I do have a question that someone may know the answer to: I can compile to line, I can't say which line until I post the code, but it's this line
switch (choice)
and the compiler is telling me 'expected unqulified-id before "switch"
which I had the same message in the prior line were I had this

movie *pmovie;=NULL;
and needed to remove ; before the = operator.
Now, I don't see anything wrong with the code, and even if I // that line out it will not compile any further. Any ideas what is wrong?
Thank You!
Joe

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. //Assignment One CIS247 Joseph Matzke
  4. #include <cstdlib>
  5. #include <iomanip>
  6. #include <iostream>
  7. #include <string>
  8. using namespace std;
  9.  
  10. struct movie
  11. {
  12.        char rating; //G,PG,PG13,R17,X
  13.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  14.        bool releaseDate; //Still in theatre-released
  15.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  16.        double cost[5]; 
  17.        double tax;
  18. };
  19. void playMovie (movie);
  20. int main(void)
  21. {
  22.     int choice = 0;
  23.     //movie anyMovie;  //declaration-creates object?
  24.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  25.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  26.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  27.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  28.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  29.     movie movie6={'X', "Caligula", false, 'S', 1.99}; 
  30.  
  31.  
  32.    do  
  33.    {
  34.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  35.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  36.        cout << "Selection:  ";
  37.        cin >> choice;
  38.        cout << endl; cout << endl; cout << endl;
  39.    }
  40.        while (choice != 0 && choice !=99);//repeat if choice not 0 or 99
  41.  
  42.        if (choice == 99)
  43.    {
  44.                   system ("pause");
  45.                   return 0;
  46.    }
  47.  
  48.  
  49.        if (choice == 0)
  50.  
  51.  
  52.   {     
  53.        cout << setw(8) << "Oceans 13 =    Movie 1" << endl << endl; 
  54.        cout << setw(8) << "Oceans 12 =    Movie 2" << endl << endl; 
  55.        cout << setw(8) << "Oceans 11 =    Movie 3" << endl << endl;
  56.        cout << setw(8) << "Braveheart =   Movie 4" << endl << endl; 
  57.        cout << setw(8) << "Harry Potter = Movie 5" << endl << endl;
  58.        cout << setw(8) << "Caligula =     Movie 6" << endl << endl << endl;
  59.        cout << setw(2) << "movie1" << endl; 
  60.        cout << setw(2) << "movie2" << endl; 
  61.        cout << setw(2) << "movie3" << endl;
  62.        cout << setw(2) << "movie4" << endl; 
  63.        cout << setw(2) << "movie5" << endl; 
  64.        cout << setw(2) << "movie6" << endl;
  65.   }   
  66.   system ("pause");
  67.   return 0;      
  68. }         
  69. void playMovie (movie)
  70.  
  71.  
  72. {
  73.      int choice = 0;
  74. cout << "Choose a movie by entering 1 thru 6" << endl;
  75. cout << "Selection :";
  76. cin >> choice;
  77. }
  78.  
  79. movie *pmovie = NULL;  //pointer to movie that user chooses
  80.  
  81. switch (choice)
  82. {
  83.     case 1:
  84.          pmovie = &movie1;
  85.          break;
  86.     case 2:
  87.          pmovie = &movie2;
  88.          break;
  89.     case 3:
  90.          pmovie = &movie3;
  91.          break;
  92.     case 4:
  93.          pmovie = &movie4;
  94.          break;
  95.     case 5:
  96.          pmovie = &movie5;
  97.          break;
  98.     case 6:
  99.          pmovie = &movie6;
  100.          break;
  101. }
  102.    // if (pmovie != NULL)
  103. //{
  104.   //             playMovie (*pmovie);
  105. //}
  106.  
  107.  
  108.  // void playMovie (cost[])
  109.  // {
  110.    //    double movie [] = {'19.99','9.99','9.99','9.99','9.99','1.99'};
  111.    //    int choice [] = {0,0,0,0,0,0};
  112.  
  113.     //   cout << "Enter movie choice" << endl;
  114.     //   cin >> choice[];
  115.   //}
  116.   //{
  117.    //    if (choice == 1);
  118.    //    cout << "movie[0]" << endl;
  119.    //      else 
  120.    //        if (choice =>2 && < 6);
  121.    //        cout << "movie[2]" << endl;
  122.    //          else cout << "movie[5]" << endl;
  123.  // }
  124.  
  125.    //    void playMovie (cost)
  126.    //    {
  127.    //          if (movie == 1)
  128.    //          cout << "Cost is 19.99:" << endl;
  129.    //          else if (movie =>1 && < 6);
  130.    //          cout << "Cost is 9.99:" << endl;
  131.    //          else 
  132.    //          cout << "Cost is 1.99:" << endl;
  133.    //    }
  134.    //    total (cost)
  135.    //    {
  136.    //    if (movie == 1)
  137.    //    cost = (19.99 * .08) + 19.99;
  138.    //    cout >> cost;
  139.    //    else if (movie =>2 && < 6);
  140.    //    cost = (9.99 * .08) + 9.99;
  141.    //    cout << cost;
  142.    //    else cost = (1.99 * .08) + 1.99;
  143.    //    cout << cost;
  144.    //    return cost;
  145.    //    }
  146.  
  147.    //    cout << "You have chosen movie " << *pmovie << "your cost is " << cost << endl;
  148.  
  149.  
  150.  
  151.  
  152.  
I believe once I get past this switch the real problems are going to occur, the output I've changed around so far, and have compiled it to this point. Now, will it work, and I also need to rearrange some code also towards the end but I'd like to see how it outputs first. Anyway, thanks again. Later
Jul 25 '07 #18
Line 79 is where the message occurs, error!.
Jul 25 '07 #19
Python, there's a contributor listed under the name Python at the O'Reilly site we visited in class today while searching through different code help, would that be you?
Jul 25 '07 #20
ilikepython
844 Expert 512MB
VRX, if you think I would know how to write that code assignment you're crazy! This is the first 'real' program I have ever tried to write myself. If you wrote some code I might see some things wrong? I have 6 days left to finish this one and I'm going backwards. I thought you were explaining to me how to approach writing a program when I started reading your posting-)
No, I wrote "Hello World" 3 months ago so I'm not the one to ask. If you thought you were posting your own thread, you were not: You simply tagged on to mine. Good luck, I know the feeling.

On to my little project that is getting there, slowly but getting there. I've decided it's easier to just write out my initial cout's as this:

cout << "Braveheart" << movie4 << endl; in order to bring the variable name to the same line as the title. The console manipulation is too advanced and I don't have the time.
I do have a question that someone may know the answer to: I can compile to line, I can't say which line until I post the code, but it's this line
switch (choice)
and the compiler is telling me 'expected unqulified-id before "switch"
which I had the same message in the prior line were I had this

movie *pmovie;=NULL;
and needed to remove ; before the = operator.
Now, I don't see anything wrong with the code, and even if I // that line out it will not compile any further. Any ideas what is wrong?
Thank You!
Joe

Expand|Select|Wrap|Line Numbers
  1.  
  2. <I had to snip your code otherwise my post wouldn't show>
  3.  
  4. void playMovie (movie)
  5.  
  6.  
  7. {
  8.      int choice = 0;
  9. cout << "Choose a movie by entering 1 thru 6" << endl;
  10. cout << "Selection :";
  11. cin >> choice;
  12. }
  13.  
  14. movie *pmovie = NULL;  //pointer to movie that user chooses
  15.  
  16. switch (choice)
  17. {
  18.     case 1:
  19.          pmovie = &movie1;
  20.          break;
  21.     case 2:
  22.          pmovie = &movie2;
  23.          break;
  24.     case 3:
  25.          pmovie = &movie3;
  26.          break;
  27.     case 4:
  28.          pmovie = &movie4;
  29.          break;
  30.     case 5:
  31.          pmovie = &movie5;
  32.          break;
  33.     case 6:
  34.          pmovie = &movie6;
  35.          break;
  36. }
  37.  
I believe once I get past this switch the real problems are going to occur, the output I've changed around so far, and have compiled it to this point. Now, will it work, and I also need to rearrange some code also towards the end but I'd like to see how it outputs first. Anyway, thanks again. Later
You ended the function again. Look at line 75. You added the closing brace to playMovie().

Shouldn't the code with the switch appear in main, if your playMovie is supposed to display the variables in a movie object? If not, what is playMovie supposed to do. I imagined playMovie like this:
Expand|Select|Wrap|Line Numbers
  1. void playMovie(movie myMovie)
  2. {
  3.     cout << "Movie name: " << myMovie.movie << endl;
  4.     cout << "Movie cost: " << myMovie.cost << endl;
  5.     cout << "Movie rating: " << myMovie.rating << endl;
  6.     cout << "Movie tax: " << myMovie.tax << endl;
  7.     // other members of a movie
  8. }
  9.  
Then in main you would prompt the user for a movie and then call playMovie with that movie.
Jul 25 '07 #21
ilikepython
844 Expert 512MB
Python, there's a contributor listed under the name Python at the O'Reilly site we visited in class today while searching through different code help, would that be you?
That's probably not me, I'm not that good (lol). I haven't contributed to anything so, probably not me. Plus, I've barely been programming for 6 months.
Jul 25 '07 #22
I thought you always needed a brace around any statement block? I've never written more than one statement block before. Now, it does compile down to the first break in the switch and says I haven't declared movie1 yet, I guess I closed main up at line where I have return 0; following all those couts, but if I don't put a brace there it won't compile. I need to move some blocks of code up higher in main first, this is going to take a while. Thanks.......again. Joe
Jul 25 '07 #23
No I didn't either, I have one open and one closed brace running now that I've removed the one at line 75. I don't know how I keep doing that. Now, the compiler hangs up at the first break in switch as it was. So, I haven't declared the variables correctly, or elements since I am using a struct. I don't understand how the pointers work I guess. I think if I change my switch to a regular switch it will work, I'm going to try it.
I know how a switch works, and I can't turn it in if I don't understand what everything in it is doing. I appreciate the jump start in pointers, but I think I'll wait until we get there. He'll be wondering how I knew about pointers anyway if I used them, which wouldn't matter if I understood them, but I don't.

Let me try changing the switch. Thanks again. Joe
Jul 25 '07 #24
OK, I'm back to abusing my defenseless mouse. Apparently there is something I don't understand about passing the value in a struct.
Why won't my switch compile??
I've tried using numerous variables in the
switch (rightHerePart)
and it's not compiling, and driving me nuts. What would the proper call be in this instance, I think and thought it would be simply

switch (myMovie.choice)

but apparently not! Do you have any ideas for me to try? Anyone/?

It compiles through the first 100 lines down to line 17 above with the following error message: struct has no member named choice--I know that, that's the cin>> I am switching. OMG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Bye

Thank You

Expand|Select|Wrap|Line Numbers
  1.        cout << setw(2) << "movie6" << endl;
  2.   }    
  3.   //system ("pause");
  4.   //return 0;      
  5. }       
  6.  void playMovie ( struct movie myMovie)
  7.  
  8. {
  9.       int choice = 0;
  10. cout << "Choose a movie by entering 1 thru 6" << endl;
  11. cout << "Selection :";
  12. cin >> choice;
  13.  
  14.  
  15. //movie *pmovie = NULL;  //pointer to movie that user chooses
  16.  
  17. switch (myMovie.choice)
  18. {
  19.     case 1:
  20.          movie1 = "Oceans 13";
  21.          break;
  22.     case 2:
  23.          movie2 = "Oceans 12";
  24.          break;
  25.     case 3:
  26.          movie3 = "Oceans 11";
  27.          break;
  28.     case 4:
  29.          movie4 = "Braveheart";
  30.          break;
  31.     case 5:
  32.          movie5 = "Harry Potter";
  33.          break;
  34.     case 6:
  35.          movie6 = "Caligula";
  36.     default: "Invalid entry";
  37. }
I'm done for the night, I won't have any computers left if I keep trying on this *&%^* program.
Joe
Jul 25 '07 #25
ilikepython
844 Expert 512MB
OK, I'm back to abusing my defenseless mouse. Apparently there is something I don't understand about passing the value in a struct.
Why won't my switch compile??
I've tried using numerous variables in the
switch (rightHerePart)
and it's not compiling, and driving me nuts. What would the proper call be in this instance, I think and thought it would be simply

switch (myMovie.choice)

but apparently not! Do you have any ideas for me to try? Anyone/?

It compiles through the first 100 lines down to line 17 above with the following error message: struct has no member named choice--I know that, that's the cin>> I am switching. OMG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Bye

Thank You

Expand|Select|Wrap|Line Numbers
  1.        cout << setw(2) << "movie6" << endl;
  2.   }    
  3.   //system ("pause");
  4.   //return 0;      
  5. }       
  6.  void playMovie ( struct movie myMovie)
  7.  
  8. {
  9.       int choice = 0;
  10. cout << "Choose a movie by entering 1 thru 6" << endl;
  11. cout << "Selection :";
  12. cin >> choice;
  13.  
  14.  
  15. //movie *pmovie = NULL;  //pointer to movie that user chooses
  16.  
  17. switch (myMovie.choice)
  18. {
  19.     case 1:
  20.          movie1 = "Oceans 13";
  21.          break;
  22.     case 2:
  23.          movie2 = "Oceans 12";
  24.          break;
  25.     case 3:
  26.          movie3 = "Oceans 11";
  27.          break;
  28.     case 4:
  29.          movie4 = "Braveheart";
  30.          break;
  31.     case 5:
  32.          movie5 = "Harry Potter";
  33.          break;
  34.     case 6:
  35.          movie6 = "Caligula";
  36.     default: "Invalid entry";
  37. }
I'm done for the night, I won't have any computers left if I keep trying on this *&%^* program.
Joe
You have all of that code in playMovie. I think it should be in main. What do you want playMovie to do?

Second, why would you put "myMovie.choice" if the variable "choice" has nothing to do with movie objects. A switch performs different actions depending on the value of the variable in the parenthesis. In your case, the variable you want to check is "choice". Here is the switch rewritten without using pointers:
Expand|Select|Wrap|Line Numbers
  1.     cout << "Choose a movie by entering 1 thru 6" << endl;
  2.     cout << "Selection :";
  3.     cin >> choice;
  4.  
  5.     movie myMovie;
  6.     switch (choice)
  7.     {
  8.         case 1:
  9.             myMovie = movie1;
  10.             break;
  11.         case 2:
  12.             myMovie = movie2;
  13.             break;
  14.         case 3:
  15.             myMovie = movie3;
  16.             break;
  17.         case 4:
  18.             myMovie = movie4;
  19.             break;
  20.         case 5:
  21.             myMovie = movie5;
  22.             break;
  23.         case 6:
  24.             myMovie = movie6;
  25.             break;
  26.         default:     // could be avoided if we used a do while as we used previously
  27.             cout << "Invalid movie number" << endl;
  28.             return 1;
  29.             break;
  30.     }
  31.     playMovie(myMovie);    // would display the movie's member variables
  32.  
Just as a note, playMovie shoudn't care what movie it is being passed, it only cares that you pass a movie. It should know nothing of the actual program, only that it should print out the variables of a movie object. Hope that helps.
Jul 25 '07 #26
Yes you are right, I am not thinking how the values are being passed using 'struct'.

This compiles but does not break, the code falls through to the default when choosing either 1 thru 6 to "Invalid movie number, why? I compared this switch to several I have written last term and see nothing that would allow the case to be ignored and program to drop through all breaks.
How do you know so much in 6 months? You've been coding longer than that?
Where is my logical error now, I thought syntax errors would make logical easy to find, I don't see it, maybe I should stop for a while, I've rewritten this code several dozen times tonight alone. Yikes.
Thanks You
Jul 25 '07 #27
Expand|Select|Wrap|Line Numbers
  1.  {
  2.       int choice = 0;
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cout << "Selection :";
  5. cin >> choice;
  6. }
  7.  
  8. movie myMovie;
  9. switch (choice)
  10. {
  11.     case 1:
  12.          myMovie = movie1;
  13.          break;
  14.     case 2:
  15.          myMovie = movie2;
  16.          break;
  17.     case 3:
  18.          myMovie = movie3;
  19.          break;
  20.     case 4:
  21.          myMovie = movie4;
  22.          break;
  23.     case 5:
  24.          myMovie = movie5;
  25.          break;
  26.     case 6:
  27.          myMovie = movie6;
  28.          break;
  29.     default: cout << "Invalid movie number" << endl;
  30.     system ("pause");
  31.          return 1;
  32.          break;
  33.  
  34. }  
It falls through all breaks no matter which case number you choose, why?
Jul 25 '07 #28
ilikepython
844 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1.  {
  2.       int choice = 0;
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cout << "Selection :";
  5. cin >> choice;
  6. }
  7.  
  8. movie myMovie;
  9. switch (choice)
  10. {
  11.     case 1:
  12.          myMovie = movie1;
  13.          break;
  14.     case 2:
  15.          myMovie = movie2;
  16.          break;
  17.     case 3:
  18.          myMovie = movie3;
  19.          break;
  20.     case 4:
  21.          myMovie = movie4;
  22.          break;
  23.     case 5:
  24.          myMovie = movie5;
  25.          break;
  26.     case 6:
  27.          myMovie = movie6;
  28.          break;
  29.     default: cout << "Invalid movie number" << endl;
  30.     system ("pause");
  31.          return 1;
  32.          break;
  33.  
  34. }  
It falls through all breaks no matter which case number you choose, why?
You could try printing choice right before the switch to see what value it has, or you can use this loop:
Expand|Select|Wrap|Line Numbers
  1. do
  2. {
  3.     cout << "Choose a movie by entering 1 thru 6" << endl;
  4.     cout << "Selection :";
  5.     cin >> choice;
  6. }
  7. while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 choice != 6);
  8. // at this point choice will be 1 - 6
  9.  
It would be much easier to use an array of movies than all those movie variables. That would eliminate the need for a switch.

After you declare the movies you just write this:
Expand|Select|Wrap|Line Numbers
  1. movie movies[6] = {movie1, movie2, movie3, movie4, movie5, movie6};
  2.  
Now you don't need a switch, you just call playMovie lke this:
Expand|Select|Wrap|Line Numbers
  1. playMovie[movies[choice-1]);
  2.  
Jul 25 '07 #29
Expand|Select|Wrap|Line Numbers
  1.  /*{
  2.       int choice = 0;
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cout << "Selection :";
  5. cin >> choice;
  6. }*/
  7. //playMovie [movies[choice - 1]);
  8. do
  9.  
  10. {
  11.  
  12.     cout << "Choose a movie by entering 1 thru 6" << endl;
  13.  
  14.     cout << "Selection :";
  15.  
  16.     cin >> choice;
  17. }
  18.     while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  19.     {
  20.     system ("pause");
  21.     return 0;
  22.  
  23.     }
  24.  // playMovie (movies [choice - 1];
  25.  
  26. /*
  27. while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  28. movie myMovie;
  29. switch (choice)
  30. {
  31.     case 1:
  32.          myMovie = movie1;
  33.          break;
  34.     case 2:
  35.          myMovie = movie2;
  36.          break;
  37.     case 3:
  38.          myMovie = movie3;
  39.          break;
I've tried this every way I can imagine, many more than shown here and regardless something is not right and I don't know what it is my friend. I have to get to class, I'll try some others tonight.
Jul 25 '07 #30
So when I declared the elements in my struct, all of the elements are basically the same thing as a variable, why given they've been declared than do they not act in the code as if they are declared variables?
I know how the prototype works, but, now I'm not using a prototype like I have in the past such as movie(&char, &int, &double, &string), now I'm using the prototype from the struct such as
movie (choice = movie1) or how does the value pass in the struct?
This is the whole problem trying to figure out where the value is, how it is passed with the proper syntax.
Thanks Joe
Jul 26 '07 #31
ilikepython
844 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1.  /*{
  2.       int choice = 0;
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cout << "Selection :";
  5. cin >> choice;
  6. }*/
  7. //playMovie [movies[choice - 1]);
  8. do
  9.  
  10. {
  11.  
  12.     cout << "Choose a movie by entering 1 thru 6" << endl;
  13.  
  14.     cout << "Selection :";
  15.  
  16.     cin >> choice;
  17. }
  18.     while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  19.     {
  20.     system ("pause");
  21.     return 0;
  22.  
  23.     }
  24.  // playMovie (movies [choice - 1];
  25.  
  26. /*
  27. while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  28. movie myMovie;
  29. switch (choice)
  30. {
  31.     case 1:
  32.          myMovie = movie1;
  33.          break;
  34.     case 2:
  35.          myMovie = movie2;
  36.          break;
  37.     case 3:
  38.          myMovie = movie3;
  39.          break;
I've tried this every way I can imagine, many more than shown here and regardless something is not right and I don't know what it is my friend. I have to get to class, I'll try some others tonight.
Expand|Select|Wrap|Line Numbers
  1.  /*{
  2.       int choice = 0;
  3. cout << "Choose a movie by entering 1 thru 6" << endl;
  4. cout << "Selection :";
  5. cin >> choice;
  6. }*/
  7. //playMovie [movies[choice - 1]);
  8. do
  9.  
  10. {
  11.  
  12.     cout << "Choose a movie by entering 1 thru 6" << endl;
  13.  
  14.     cout << "Selection :";
  15.  
  16.     cin >> choice;
  17. }
  18.     while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  19.     {                               // what's this?
  20.     system ("pause");      //
  21.     return 0;                    //
  22.  
  23.     }                           //
  24.  // playMovie (movies [choice - 1]);     // that should work
  25.  
  26. /*
  27. while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);
  28. movie myMovie;
  29. switch (choice)
  30. {
  31.     case 1:
  32.          myMovie = movie1;
  33.          break;
  34.     case 2:
  35.          myMovie = movie2;
  36.          break;
  37.     case 3:
  38.          myMovie = movie3;
  39.          break;
You almost have it. I don't know why you had that code with the system call and the return statement. This should work:
Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.     int choice = 0;
  4.     //movie anyMovie;  //declaration-creates object?
  5.     movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  6.     movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  7.     movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  8.     movie movie4={'R', "Braveheart", false, 'E', 9.99};
  9.     movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  10.     movie movie6={'X', "Caligula", false, 'S', 1.99};\
  11.  
  12.     movie movies[6] = {movie1, movie2, movie3, movie4, movie5, movie6};
  13.  
  14.  
  15.    do  
  16.    {
  17.        cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  18.        cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  19.        cout << "Selection:  ";
  20.        cin >> choice;
  21.        cout << endl; cout << endl; cout << endl;
  22.    }
  23.    while (choice != 0 && choice !=99);   //repeat if choice not 0 or 99
  24.  
  25.     if (choice == 99)
  26.     {
  27.         system ("pause");
  28.         return 0;
  29.     }  
  30.  
  31.     if (choice == 0)     
  32.     {     
  33.         cout  << "Movie 1:\t" << movies[0].movie << endl;     // avoid hard coding literals
  34.         cout  << "Movie 2:\t" << movies[1].movie << endl; 
  35.         cout  << "Movie 3:\t" << movies[2].movie << endl;
  36.         cout  << "Movie 4:\t" << movies[3].movie << endl; 
  37.         cout  << "Movie 5:\t" << movies[4].movie << endl;
  38.         cout  << "Movie 6:\t" << movies[5].movie << endl << endl;
  39.     }
  40.  
  41.     do
  42.     {
  43.         cout << "Choose a movie by entering 1 thru 6" << endl;
  44.         cout << "Selection :";
  45.         cin >> choice;
  46.     } while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);  // make sure choice is 1 through 6
  47.  
  48.     playMovie(movies[choice-1]); // display correct movie; note: indexing starts at 0
  49.  
  50.     system ("pause");
  51.     return 0;      
  52. }
  53.  
If you don't understand any of it just ask and I will help you. Don't use something if you don't understand it.
Jul 26 '07 #32
ilikepython
844 Expert 512MB
So when I declared the elements in my struct, all of the elements are basically the same thing as a variable, why given they've been declared than do they not act in the code as if they are declared variables?
I know how the prototype works, but, now I'm not using a prototype like I have in the past such as movie(&char, &int, &double, &string), now I'm using the prototype from the struct such as
movie (choice = movie1) or how does the value pass in the struct?
This is the whole problem trying to figure out where the value is, how it is passed with the proper syntax.
Thanks Joe
I don't really understand what you are talking about. Member of a struct can only be accesed by objects of that struct using the '.' operator. What do you mean by prototype? If you want to write a function that takes a movie struct object as a parameter, write this:
Expand|Select|Wrap|Line Numbers
  1. void funcName(movie testMovie);
  2.  1       2      3        4
  3. 1 = return type of function
  4. 2 = name of function
  5. 3 = type of parameter, in your case movie
  6. 4 = name of parameter (optional in prototype)
  7.  
What don't you understand?
Jul 26 '07 #33
OK, few questions
Expand|Select|Wrap|Line Numbers
  1.  #include <iostream>
  2. #include <iomanip>
  3. #include <cstdlib>
  4. #include <string>
  5. using namespace std;
  6. struct movie
  7. {
  8.        char rating; //G,PG,PG13,R17,X
  9.        string movie; //Oceans 13, Oceans 12, Oceans 11, Braveheart, Harry Potter, Caligula
  10.        bool releaseDate;//released-inTheatre
  11.        char language;//English E, Spanish S, Japanese J, Chinese C, German G, Swaheely S
  12.        double cost; 
  13.        double tax;
  14. };
  15. void playMovie (movie);
  16.  
  17.       int main()
  18.  
  19.       {
  20.  
  21.           int choice = 0;
  22.  
  23.          // movie anyMovie;  //declaration-creates object?
  24.  
  25.           movie movie1={'R', "Oceans 13", true, 'E', 19.99, .08}; //movie number 1
  26.  
  27.           movie movie2={'R', "Oceans 12", false, 'E', 9.99};
  28.  
  29.           movie movie3={'R', "Oceans 11", false, 'E', 9.99};
  30.  
  31.           movie movie4={'R', "Braveheart", false, 'E', 9.99};
  32.  
  33.           movie movie5={'G', "Harry Potter", false, 'E', 9.99};
  34.  
  35.           movie movie6={'X', "Caligula", false, 'S', 1.99};\
  36.  
  37.  
  38.  
  39.           movie movies[6] = {movie1, movie2, movie3, movie4, movie5, movie6};
  40.  
  41.  
  42.  
  43.  
  44.  
  45.          do 
  46.  
  47.          {
  48.  
  49.              cout << "Please enter 0 to list all movies" << endl; //makes sense to display the menu for choice
  50.  
  51.              cout << "Pleae enter 99 to end the program" << endl; //either display the menu or stop the program
  52.  
  53.              cout << "Selection:  ";
  54.  
  55.              cin >> choice;
  56.  
  57.              cout << endl; cout << endl; cout << endl;
  58.  
  59.          }
  60.  
  61.          while (choice != 0 && choice !=99);   //repeat if choice not 0 or 99
  62.  
  63.  
  64.  
  65.           if (choice == 99)
  66.  
  67.           {
  68.  
  69.               system ("pause");
  70.  
  71.               return 0;
  72.  
  73.           } 
  74.  
  75.  
  76.  
  77.           if (choice == 0)     
  78.  
  79.           {     
  80.  
  81.               cout  << "Movie 1:\t" << movies[0].movie << endl;     // avoid hard coding literals
  82.  
  83.               cout  << "Movie 2:\t" << movies[1].movie << endl;
  84.  
  85.               cout  << "Movie 3:\t" << movies[2].movie << endl;
  86.  
  87.               cout  << "Movie 4:\t" << movies[3].movie << endl;
  88.  
  89.               cout  << "Movie 5:\t" << movies[4].movie << endl;
  90.  
  91.               cout  << "Movie 6:\t" << movies[5].movie << endl << endl;
  92.  
  93.           }
  94.  
  95.  
  96.  
  97.           do
  98.  
  99.           {
  100.  
  101.               cout << "Choose a movie by entering 1 thru 6" << endl;
  102.  
  103.               cout << "Selection :";
  104.  
  105.               cin >> choice;
  106.  
  107.           } 
  108.           while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);  // make sure choice is 1 through 6
  109.  
  110.  
  111.  
  112.           playMovie(movies[choice-1]); // display correct movie; note: indexing starts at 0
  113.  
  114.  
  115.  
  116.           system ("pause");
  117.  
  118.           return 0;     
  119.  
  120.       }
  121.  
This compiles, but does not link. Produces the error message
Linker error. undefined reference to 'playMovie(movie)' and I have not clue one what this means.
I need only to add some very basic modules now adding final output with cost, tax, title, in correct format.
As for a few coding questions it will be easier if I post them with code snippets one at a time. I thank you for your indulgence. Joe
Jul 27 '07 #34
I don't access any members of struct per say using the '.' operator in the above code, which I need to do. The entire thing is this supposedly is an EASIER way to begin to understand OOP, which I'm not too sure about. Using a struct for your first program that is kind of object oriented as movie has sub sets of itself which makes it an object, correct? movie has, title, rating, et cetera so it has attributes making it an object, even though it is a struct! See this may not be confusing to you, but it is very confusing to me. I could get this desired output in 20 minutes if I could use primitive variables and simply write the program.

In the code:

Expand|Select|Wrap|Line Numbers
  1.  while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);  // make sure choice is 1 through 6
  2.  
  3.  
  4.  
  5.           playMovie(movies[choice-1]);
Wouldn't this, or shouldn't this be less the !?

like while(choice ==1 || choice ==2||choice==3 ........)
playMovie(movies[choice-1]; so that whatever the user enters it is minus one thereby displaying the correct array value?? Why would it be while choice is not equal to 1? I don't understand that one. If it's && the user is going to have to enter 1,2,3,4,5,6 to get anything, correct? If it would compile I would know, but I think this is right. You have to remember last term we wrote ONE if loop, ONE while loop, ONE for loop, ONE switch statement, ONE prototype program, ONE getline program, so it's not like I've written a hundred while loops using these operands. Just makes sense to me this would not work.

Here's another:
Expand|Select|Wrap|Line Numbers
  1.  if (choice == 0)     
  2.  
  3.           {     
  4.  
  5.               cout  << "Movie 1:\t" << movies[0].movie << endl;     // avoid hard coding literals
  6.  
What does "avoid hard coding literals mean? I understand the concept of hard coding as in -- int i = 10; ,, it's the literal I don't understand. The other

Expand|Select|Wrap|Line Numbers
  1.  cout  << "Movie 6:\t" << movies[5].movie << endl << endl;
The >movies[5].movie<< I understand this, the "Movie 6:/t << I do not.

/t must be a short cut like /n for endl; is that I have not seen before.

Other than that I do understand every line, what it is doing, why, and just need to figure out the best place to put the calc, and display modules and hopefully it will compile. Thanks for your patience and help Python, I am struggling with this but my professor continues to tell me one day the light simply turns on and poof, you're a programmer. Ha, we'll see.

OK, I've got to start thinking about this, and try and google that compiler message which I doubt I'll find anything on as it is referring to playMovie. I've never encountered a program that compiles but does not link.
Thanks Joe
Jul 27 '07 #35
ilikepython
844 Expert 512MB
OK, few questions
<Sorry, I had to snip your code again>

This compiles, but does not link. Produces the error message
Linker error. undefined reference to 'playMovie(movie)' and I have not clue one what this means.
I need only to add some very basic modules now adding final output with cost, tax, title, in correct format.
As for a few coding questions it will be easier if I post them with code snippets one at a time. I thank you for your indulgence. Joe
That linker error usually means that you have a prototype of a function that you never defined. So you have your playMovie prototype but you never define it. All you have to do is include the actual body of the playMovie() function.
Jul 27 '07 #36
ilikepython
844 Expert 512MB
I don't access any members of struct per say using the '.' operator in the above code, which I need to do. The entire thing is this supposedly is an EASIER way to begin to understand OOP, which I'm not too sure about. Using a struct for your first program that is kind of object oriented as movie has sub sets of itself which makes it an object, correct? movie has, title, rating, et cetera so it has attributes making it an object, even though it is a struct! See this may not be confusing to you, but it is very confusing to me. I could get this desired output in 20 minutes if I could use primitive variables and simply write the program.
You are not accesing any members because you don't need to. All you need to do, is display the variables, which you will do in playMovie (you pass the desired movie to the function). You could probably get the output easier but it would not be a very flexible program. RIght now, you have six movies, it's also very easy to add more movies or change one of the movies's attributes.
In the code:

Expand|Select|Wrap|Line Numbers
  1.  while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5 && choice != 6);  // make sure choice is 1 through 6
  2.  
  3.  
  4.  
  5.           playMovie(movies[choice-1]);
Wouldn't this, or shouldn't this be less the !?

like while(choice ==1 || choice ==2||choice==3 ........)
playMovie(movies[choice-1]; so that whatever the user enters it is minus one thereby displaying the correct array value?? Why would it be while choice is not equal to 1? I don't understand that one. If it's && the user is going to have to enter 1,2,3,4,5,6 to get anything, correct? If it would compile I would know, but I think this is right. You have to remember last term we wrote ONE if loop, ONE while loop, ONE for loop, ONE switch statement, ONE prototype program, ONE getline program, so it's not like I've written a hundred while loops using these operands. Just makes sense to me this would not work.
The type of condition in the while loop can be confusing lots of times. What it says is, loop throught the loop again if choice is not 1, and choice is not 2, and choice is not 3, etc... So if choice is either 1, 2, 3, 4, 5, or 6 it will go past the loop. You want to loop again if choice is not 1 through 6. Does that make sense? Tell me if it doesn't.

To play the correct movie, you simply call the function with variable at array offset choice - 1. The array is in order. So if user picks, 4 for example, you need to call movies[3] (the 4th movie). Remember, arrays start counting at zero.
Here's another:
Expand|Select|Wrap|Line Numbers
  1.  if (choice == 0)     
  2.  
  3.           {     
  4.  
  5.               cout  << "Movie 1:\t" << movies[0].movie << endl;     // avoid hard coding literals
  6.  
What does "avoid hard coding literals mean? I understand the concept of hard coding as in -- int i = 10; ,, it's the literal I don't understand. The other

Expand|Select|Wrap|Line Numbers
  1.  cout  << "Movie 6:\t" << movies[5].movie << endl << endl;
The >movies[5].movie<< I understand this, the "Movie 6:/t << I do not.

/t must be a short cut like /n for endl; is that I have not seen before.
By not hard coding, literals, I mean don't say "cout << "Ocean's 12" << endl;" If you want to print the name of the movie Ocean's 12. Let's say you want to change the name of that movie. You have to change it in two places, possibly more (declaration and literals). You can avoid that by just using the struct variable. "movies[0].movie. The "\t" just means tab. It's like "\n" except "\n" is a newline and "\t" is a tab.
Other than that I do understand every line, what it is doing, why, and just need to figure out the best place to put the calc, and display modules and hopefully it will compile. Thanks for your patience and help Python, I am struggling with this but my professor continues to tell me one day the light simply turns on and poof, you're a programmer. Ha, we'll see.
The professor might be right :) Just don't give up, and ask questions if you need to.
Jul 27 '07 #37
Python you've helped me through my first two weeks and I can't thank you enough. I now, have an understanding of structs and how they work, hard coding and why it is not good to do, much easier to change one attribute than it is to comb through code looking for every instance of your hard coded crap. I understand the while loop much deeper than I did, I picked up several new short cuts such as /n and /t which are handy.
Biggest thing is I've been up since 11am yesterday, left class at 6 and stayed up all night writing this program. I dumped the whole damn bowl of spaghetti and started over. I made an IPO chart, I made a visio flowchart, I used real movies with their directors, time et cetera and started coding.
I wrote each module by itself first, compiled along the way, fixed along the way, and viola a program, and it works.
I'm the happiest C++ guy in North America, or was until I looked in our doc share bin and found this weeks assignment sitting there. Yikes, I can't keep up...

Well, looks like I get to learn how to write a program that pulls from a file, and writes to the file, and updates and sorts the file for stock exchange symbols and their prices. Insanity to think I can write that! But I'm gonna try-

First, look at this
Expand|Select|Wrap|Line Numbers
  1. // Assignment 1 CIS 247
  2. // Joseph L Matzke
  3.  
  4.  
  5. #include <iostream>
  6. #include <iomanip>
  7.  
  8. using namespace std;
  9.  
  10. struct Movie {
  11.     char  title[256];//Max her out
  12.     char  director[30];//Give me enough room
  13.     int  minutes; //Just to come up with some other element
  14.     char genre; // Technical, Fantasy, History, Classics gives me another attribute
  15.     double price; //Seems technical books out cost classics by far, it's insane
  16.  
  17. };
  18.  
  19. void showItem(Movie );
  20.  
  21. int main()
  22. {
  23.  
  24.     Movie movie[8] =    //might as well be eight or eighty just more typing once you get it
  25.     {
  26.         {"Harry Potter and the Deathly Hallows", "J. K. Rowling ",159, 'F',17.99},
  27.         {"Armed America: Documentary of Gun Owners in Their Homes", "Kyle Cassidy",94,'H',19.80},
  28.         {"The Old Man and The Sea","Ernest Hemingway",112,'C', 9.80},
  29.         {"Adventures of Huckleberry Finn (Mark Twain Library)","Mark Twain",129,'C',10.17},
  30.         {"A Christmas Carol","Charles Dickens",145,'C',4.49},//lists them in order like a prototype
  31.         {"C++ Programming (THIRD EDITION)", "D S MALIK",71,'T',127.30},
  32.         {"Legacy of Ashes: The History of the CIA", "Tim Weiner", 120, 'H', 15.12},
  33.         {"Introduction to Programming with C++", "Diane Zuk", 50, 'T', 123.79}//lists object elements,attributes
  34.  
  35.     };
  36.  
  37.  
  38.  
  39.  
  40.     bool exit = false;//assign false to exit, gonna change that down the line
  41.     do {
  42.         cout << "Type item no. to display info; 0 to display all the items, 99 to exit" << endl << endl;
  43.         int choice;
  44.         cin >> choice;
  45.  
  46.         switch (choice) {
  47.             case 1:
  48.             case 2:
  49.             case 3:
  50.             case 4:
  51.             case 5:
  52.             case 6:
  53.             case 7:
  54.             case 8:
  55.  
  56.                 showItem(movie[choice-1]);//using my array to display, it starts at 0 so I less one -)
  57.                 break;
  58.             case 0:
  59.                 cout << "Here are all the movies available :" << endl;
  60.                 for (int i=0; i < 8; i++) //here's my array loop
  61.                                 {
  62.                     showItem(movie[i]);
  63.                 }
  64.                 break;
  65.  
  66.             case 99: 
  67.                 exit = true;        
  68.                 break;
  69.             default:
  70.                 cout << "Incorrect value entered; try again" << endl;
  71.  
  72.         }
  73.     } while (!exit);//while we are not exiting
  74.  
  75.  
  76.     return 0;
  77. }
  78.  
  79. void showItem(Movie b) {
  80.  
  81.  
  82.  
  83.     cout << endl << "*************************************" << endl;//stole this idea from Zeschke
  84.     cout << "Information on " << "\""<<b.title<<"\":" << endl;
  85.     cout << "Director: " << b.director << endl;
  86.     cout << "Title: " << b.title << endl;
  87.     cout << "Number of minutes: " << b.minutes << endl;
  88.  
  89.     cout << "Genre: ";//calling my struct attributes with the '.' operator for my switch statement
  90.     switch (b.genre) {
  91.         case 'T' : cout << "Technical";
  92.                 break;
  93.         case 'F' : cout << "Fantasy";
  94.                 break;
  95.         case 'H' : cout << "History";
  96.                 break;
  97.         case 'C' : cout << "Classics";
  98.                 break;
  99.         default : cout << "!!Wrong Genre";
  100.  
  101.     }
  102.  
  103.     cout << endl;                                 //usually you don't need std:: except when using setprecision i think
  104.  
  105.     cout << std::fixed << std::setprecision(2) << "Price: " << b.price << endl;//i knew there was something missing 
  106.     cout << "Tax: "<< b.price * 0.085 << endl;                                // using namespace std takes care of std::
  107.     cout << "Total Cost: "<< b.price * 1.085 << endl;                         //calling all elements with the '.' operand
  108.     cout << "*************************************" << endl;                  //i spent, ahhhhhh, about 40 hrs writing this prgm
  109.                                                                               //trashed about 9 builds resulting in perfection
  110.                                                                               //later JL Matzke
  111. }
  112.  
Hope your around in a few days when my program writing from file doesn't work. If you ever need anything. Joe
Jul 27 '07 #38
ilikepython
844 Expert 512MB
Python you've helped me through my first two weeks and I can't thank you enough. I now, have an understanding of structs and how they work, hard coding and why it is not good to do, much easier to change one attribute than it is to comb through code looking for every instance of your hard coded crap. I understand the while loop much deeper than I did, I picked up several new short cuts such as /n and /t which are handy.
Biggest thing is I've been up since 11am yesterday, left class at 6 and stayed up all night writing this program. I dumped the whole damn bowl of spaghetti and started over. I made an IPO chart, I made a visio flowchart, I used real movies with their directors, time et cetera and started coding.
I wrote each module by itself first, compiled along the way, fixed along the way, and viola a program, and it works.
I'm the happiest C++ guy in North America, or was until I looked in our doc share bin and found this weeks assignment sitting there. Yikes, I can't keep up...

Well, looks like I get to learn how to write a program that pulls from a file, and writes to the file, and updates and sorts the file for stock exchange symbols and their prices. Insanity to think I can write that! But I'm gonna try-

<That's the third time, I think I might start a thread in the feedback forum>

Hope your around in a few days when my program writing from file doesn't work. If you ever need anything. Joe
Congrats, good work Joe!!. That program is a big improvement over your others. I really liked what you did. Good luck, on your next assignement. It will surely be easier now that you have a written some programs and gained more experience. Also, when you get stuck, don't forget to use Google. I use it all the time and it can help you find what you need. And don't get frustrated, keep trying. Wish you good luck ;-)
Jul 28 '07 #39

Sign in to post your reply or Sign up for a free account.

Similar topics

30
by: stephen henry | last post by:
Hi all, I have a question that I'm having difficulty answering. If I have a struct: typedef struct my_struct_tag{ struct my_other_struct *other; } my_struct_tag
5
by: Bilgehan.Balban | last post by:
Hi, I am currently brushing up my c++ knowledge and I would like to ask you about the differences between classes and C structs, in the function/method perspective. 1) Is it correct to say...
20
by: pinkfloydhomer | last post by:
Is it well-defined and portable to do something like: typedef struct { int type; char c; } S1; typedef struct {
61
by: Marty | last post by:
I am new to C# and to structs so this could be easy or just not possible. I have a struct defined called Branch If I use Branch myBranch = new Branch(i); // everything works If I use Branch...
17
by: Johan Tibell | last post by:
Could someone outline the pros and cons of typedefing pointers to structs like this? typedef struct exp_ { int val; struct exp_ *child; } *exp; (This is straight from memory so it might not...
5
by: Daniele M. | last post by:
Hi folks! I'm almost newbie in c++ programming, so please don't blame me :) I have a little (i hope) problem with following code and i really can't understand what i'm missing :( Hope you can...
1
by: radskate360 | last post by:
Hi I am newer to programming and need a bit of help with this program. OK, heres the directions. The distance between two places on earth can be calculated by using their latitudes and...
5
by: robert | last post by:
Hi all, I'm trying to understand some code - u-boot 1.3rc3 - that reads data from an ethernet phy. A struct is defined as: struct mii_dev { struct list_head link; char *name; int (*...
17
by: mdh | last post by:
Quick question. In the code below, omitting the word "word", as in char *word, produces an error of syntax. In similar "non-struct" declarations, the expression "char *" should suffice. ( I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.