I've never posted in a forum before. I wish I could highlight my "else" errors I'm getting. Does anyone see anything wrong with this code pertaining to if/else statements? It's maddening. I'm getting four errors on my "else's".
It's the four that are in the two separate functions (each one starts with "else if", then has another else after it). It's for class, and it's a program to calculate the calories a male/female needs to maintain their current weight (with an activity level and weight). Please and thank you
//IV. Code the algorithm into a Program
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
//declare variables and named constants
char gender = ' ';
char level = ' ';
double weight = 0.0;
double dcn = 0.0;
//enter input items
cout << "Enter gender to determine how many calories are needed to maintain your current weight (M or F): ";
cin >> gender;
gender = toupper(gender);
yes there seems to be two "else" statement.
try to use brackets "{}" to execute more that one line in "if" statement, that will help you find the problem.
hye,some one please help me.why when i enter month=12,date =15,it doesnt display"available"?it suppose to print it .where i did mistakes?
i really need your help
#include<stdio.h>
int main()
{
int date,month,year;
printf("Please enter year:");
scanf("%d",&year);
printf("Please enter month:");
scanf("%d",&month);
printf("Please enter date:");
scanf("%d",&date);
if((month==1)&&(month==3)&&(month==12)){
if((date<10)&&(date>20)){
printf(" not available");
}
Please start your own topic, don't hijack this one. Starting your own topic is easy. When you do put your code into code tags. Select your code, then press the <> button on the right under formatting.
If you don't do this, you might not get any replies, or worse you could be reported which would remove your post.