it builds correctly and runs correctly but when the program gets to the while statement, it just stops completely, does not even allow blind input of data.
I know it is a little messy but here is the code:

// buildingwillcost.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <math.h>
#include <iostream>
using namespace std;


int main()
{
	float length1, length2, length3, length4, length5, length6;
	int wallNum, totalSheets;
	float totallength[100];
	float totalCost, sheetrockCost, tenFTcost, tenFTTOTALcost, eightFTcost, eightFTTOTALcost;
	float totalTen, totalEight;
	float SHEETROCKCOST[100]; 
	int numWall, numWall2;
	cout << "How many walls do you have to do this for?\n";
	cin >> wallNum;
	cout << "How much does a 2x4x8 cost?\n";
	cin >> eightFTcost;
	cout << "How much does a 2x4x10 cost?\n";
	cin >> tenFTcost;
	int current1, current2, current3, current4;
	int length[1000];
	int sheetrockSheets;
	int sheetType[100];
	float costofsheetrock[100];
	int NUMWALL[100];
	// number of walls with a certain type of sheetrock	
	current1 = 1;
	while (current1 <= 2);
	{
		cout << "How many walls will be using this type of sheetrock?\n";
		cin >> numWall;
		cout << "How much does sheetrock of this type cost?\n";
		cin >> sheetrockCost;
		SHEETROCKCOST[current1] = sheetrockCost;
		NUMWALL[current1] = numWall;
		current1 = current1 + 1;
	}
	// user input
	totalSheets = 0;
	totalTen = 0;
	totalEight = 0;
	totalCost = 0;
	current2 = 1;
	while (current2 <= 2);
	{
		eightFTTOTALcost = 0;
		tenFTTOTALcost = 0;
		numWall2 = NUMWALL[current2];
		current3 = 1;
		while (current3 <= numWall2);
		{
			cout << "Please enter wall length in this order:\n";
			cout << "Feet, inches, numerator of fraction over 16\n";
			cin >> length1;
			cin >> length2;
			cin >> length3;
			length4 = length1 / 12;
			length5 = length4 + length2;
			length6 = (length3 / 16) + length5;
			length[current3] = ceil((length6 / 12));
			totallength[current3] = totallength[current3] + length[current3];
			totalEight = totalEight + (length6 / 12 / 16);
			totalTen = totalTen + (length6 / 12 / 10);
			eightFTTOTALcost = (length[current3] / 16 * eightFTcost) + eightFTTOTALcost;
			tenFTTOTALcost = (length[current3] / 10 * tenFTcost) + tenFTTOTALcost;
			current3 = current3 + 1;
		}
		numWall2 = NUMWALL[current2];
		sheetrockSheets = ceil(totallength[current3] / 4);
		costofsheetrock[current2] = (sheetrockSheets * SHEETROCKCOST[current2]);
		totalCost = totalCost + eightFTTOTALcost + tenFTTOTALcost + costofsheetrock[current2];
		current2 = current2 + 1;
	}
	// print sequence
	cout << "After careful consideration, I have calculated that you will need:\n";
	cout << "A budget of: $" << totalCost;
	cout << "To cover the cost of the\n";
	cout << totalTen << " 10ft. boards\n";
	cout << totalEight << " 8ft. boards\n";
	cout << "and for the\n";
	current4 = 1;
	while (current4 <= 2);
	{
		cout << sheetType[current4] << " 4ft. by 8ft. sheets of sheetrock type " << current4;
	}
	cout << "Good-bye, good luck on the project and have a nice day\n";
	return 0;
}

Recommended Answers

All 4 Replies

while (current3 <= numWall2);

Remove this ;

IN line 33, 49, and 87, remove the semicolon so the while loop executes
like the above post said.

while (current3 <= numWall2);

Remove this ;

why?

When you add the semicolon, that is the scope of the loop. while (true) {this stuff executes} while (true); {this stuff never executes} The semi-colon is terminating the scope of the loop before it executes the stuff inside the braces. The same applies for 'if' and 'for'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.