Im trying to write a program where the user enters a viewing code and get a cost and the viewing code back. Im trying to use functions as its part of the project but i cant seem to get it. What am I missing? I get no values back and get lots of errors.
/*Program: prog2B.cpp
By: Irvin Florencia
Last Modified: October 20,2017
Purpose: Display price of viewings.
*/
//Directives
#include<iostream>
#include<string>
using namespace std;
void tv();
void brandNew();
int oldMovies(int year);
void displayResults();
int main()
{
char code;
string title, cost, viewing;
int year ;
void brandNew();
int oldMovies(int year);
void displayResults();
1) Where does brandNew()'s block end? There is no closing brace.
2) In the function int oldMovies(int year) the declaration of cost and viewing is missing a semi-colon at the end.
3) if and ifelse statements allow you to state conditions but that is not allowed in else statements. An else is what the program goes for when it is completely out of possible options, so the last possible condition is embedded in the else statement. As you can see in the else statement in the function oldMovies(int year) you have tried to give a condition for the else statement.
4) You are not using year, the int variable you declared in main().
5) And why doesn't oldMovies(int year) return anything while it is declared as an int returning function?
P.S. For the sake of readability, put your code in code blocks. Select edit, select your hole code then click on '<>' from the menu of formats provided.