simple question that baffles me. attempting to get multiple data from a user, but cannot get the program to "wait" for the data. It spits out all the questions at once.
here's what I have written

//woody0114
#include <iostream>
#include<cmath>
using namespace std;
double HSF(double ft_height, double ft_width, double s_height, double s_width, double g_area);
double WDarea(double w_height, double w_width, double d_height, double d_width ); 
int main()
{
    double hsf;
    char nom;
    double ft_height, s_height, ft_width, s_width, g_area, doors, windows;
    cout<<"Welcome to the Cheap Paint Company, Please tell me your name.\n";
    cin >>nom;


    cout<<"Enter the height of the front of your house from the bottom of the siding to the soffit\n";
    cin >>ft_height;


    cout<<"Enter the width of the front of your house\n";
    cin >>ft_width;


    cout<<"Enter the height of the side of your house from the bottom of the siding to the gable tip\n";
    cin>>s_height;

    cout<<" Enter the width of the side of your house\n";
    cin>>s_width;

    hsf= HSF(ft_height, ft_width, s_width, s_height, g_area);
    cout<<nom<<"The initial square footage of your house is"<<hsf<<"square feet"; 
        system("PAUSE");
    return EXIT_SUCCESS;
}
double HSF(double ft_height, double ft_width, double s_height, double s_width, double g_area)
       {
       double hsf, squarefoot;
       squarefoot = (ft_height*ft_width)+(ft_height*s_width);
       g_area= (s_height-ft_height)*s_width;
       hsf = squarefoot + g_area;
       return (hsf);

It asks the first question and allows the user to input their name, then the program spits out the other questions all at once and does not allow for the cin info to be input

Your character array does not have an assigned size, (and someone correct me if I'm wrong) but I believe that when you press enter after typing your name, the '\n' character stays in the inpout stream, causing all of the other questions to be skipped. here's how I solved the problem:

char nom; //change this to:
char nom[22]; //22 is the size of the character array, you can make this any size you want.

when I did that little change, everything worked just fine for me :)

Derek Elensar

Thanks a bunch. That did it. I appreciate your time and knowlege

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.