Trying to come up with a code that will give you your circumference value by taking the measurements of your waist and hips and subtracting the measurement of your neck but I'm getting several very weird errors. Most of them in regards to !=. Can someone please take a look and let me know what I am doing wrong.

/****************************************************/
/* File: Final Project                              */ 
/*                                                  */ 
/* Created by: <<removed by request>>                      */ 
/* Date: April 07, 2010                             */ 
/*                                                  */ 
/* Program to compute circumference values          */ 
/*                                                  */ 
/* Inputs: (keyboard)                               */ 
/*   Three positive float (n, w & h)      */ 
/*                                                  */
/* Output:                                          */ 
/*   Corresponding circumference value              */
/*        for females ((w+h)-n)                     */ 
/*                                                  */
/* Algorithm: see attached description              */ 
/****************************************************/
 
#include <iostream> 
using namespace std ; 
float mbrcircumval(float n, float w, float h) ; //
string mbrname, response

int main()
{    
   cout << "Would you like to enter measurements for an individual?" ;
   cout << "You must enter yes or no : " ;
   cin >> response ;
   while (response != no)  

  {

   // read in member's 
    cout << "Please enter the name of the member whose measurements"
    cout << "you are entering : " ;      
    cin >> mbrname ;

     float n, w, h ;   //  
     float result ;
   
     cout << endl ; 

   // read in n, w & h 
  
   cout << "Enter n (the members neck measurement in inches) :  " ;
   cin >> n ; 
   cout << "Enter w (the members waist measurement in inches) : " ;
   cin >> w ;
   cout << "Enter h (the members hip measurement in inches) : " ;
   cin >> h ;

   result = mbrcircumval (n, w, h)  ; 

   cout << "The circumference value for " << mbrname << "is" << 
      << " = " << result << endl ;
   
   } 
}

// ********************************************************

float mbrcircumval(float n, float w, float h)

/* Computes the circumference value      */
/*                                       */
/* Inputs:                               */
/*    n, w, h (floats)                   */
/*                                       */
/* Output:                               */
/*    circumference value (float)        */

{
   if ((h+w) < n) 
   {
     return(0) ; 
   }
   else 
   {
      return ((w+h)-n) ; 
   } 
}

I'm guessing you're talking about the while on line 29?

As you have written it, you are attempting to compare the values stored in the variables named response and no. The problem is that the variable no does not exist. Based on what I see, you should consider re-writing the no as a string literal. To do that, place the no in double-quotes
i.e. response != "no"

Thank you that actually worked. I tried single quotes but not double quotes. I don't know why I didn't try double quotes in the beginning. Now it compiles but I'm trying to get it to return to the beginning where it ask if you want to enter measurements because as it is right now it just goes right back to asking for name and measurements because the answer is still yes as far as the program is concerned. Please take a look and let me know what I can change.

I'm guessing you're talking about the while on line 29?

As you have written it, you are attempting to compare the values stored in the variables named response and no. The problem is that the variable no does not exist. Based on what I see, you should consider re-writing the no as a string literal. To do that, place the no in double-quotes
i.e. response != "no"

Thank you that actually worked. I tried single quotes but not double quotes. I don't know why I didn't try double quotes in the beginning.

Programming isn't a trial and error process (at least not with syntax). If you have a string, you know if and when, and which quotes are needed.

Now it compiles but I'm trying to get it to return to the beginning where it ask if you want to enter measurements because as it is right now it just goes right back to asking for name and measurements because the answer is still yes as far as the program is concerned. Please take a look and let me know what I can change.

If you are using the program, what would you expect to happen once you've entered the measurements for the current person?

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.