Can anyone help:
//
// main.c
// assignment
//
// Created by Khondakar Zille Mowla on 7/2/13.
// Copyright (c) 2013 Khondakar Zille Mowla. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
void header ()
{
printf("&&&&&&&&&&&&&&&&&&&&&&&\n");
printf("Welcome to this program");
printf("&&&&&&&&&&&&&&&&&&&&&&&\n");
}
void displaymenu()
{
printf("Please select any task from following options");
printf("A To Perform Substraction");
printf("B to Calculate the Average Value");
printf("C to Determine the Median Value");
printf("D to display a Rectangle");
printf("E to Exit the Program");
}
void substraction()
{
int int1, int2, sub;
printf("Enter first Integer\n");
scanf("%d", &int1);
printf("Enter Second Integer\n");
scanf("%d", &int2);
sub=int1-int2;
printf("The substraction of the two integer %d and %d is %d", int1, int2, sub);
}
void average()
{
float flo1, flo2, flo3, average;
printf("Please enter three number to calculate average");
scanf("%f%f%f", &flo1, &flo2, &flo3);
average = (flo1 + flo2 + flo3) / 3;
printf("The average of %f, %f and %f is %f", flo1, flo2, flo3, average);
}
void median()
{
int h, i, j;
int median;
printf("Please enter three integer to determine the median");
scanf("%d%d%d", &h, &i, &j);
if ((i >= h && i <= j) ||
(i >= j && i <= h)) median = i;
else if ((h >= i && h <= j) ||
(h >= j && h <= i)) median = h;
else
median = j;
printf("The median for %d, %d and %d is %d ", h, i, j, median);
}
void rectangle()
{
const int row = 5;
int width;
printf("Please enter width for the rectangle");
scanf("%d",&width);
for(int i = 0;i<row;i++){
for(int j = 0;j<width;j++){
printf("*");
}
printf("\n"); (FIRST ERROR HERE)
}
int main()
{
char option;
int counter1 = 0,counter2 = 0,counter3 = 0,counter4 = 0;
header();
displayList();
do{
scanf("%c",&option);
switch(tolower(option))
{
case 'a':
substraction();
displaymenu();
counter1++;
break;
case 'b':
average();
displaymenu();
counter2++;
break;
case 'c':
median();
displaymenu();
counter3++;
break;
case 'd':
rectangle();
displaymenu();
counter4++;
break;
case 'e':
printf("You Have Chosen option A for: %d\n",counter1);
printf("You Have Chosen option B for: %d\n",counter2);
printf("You Have Chosen option C for: %d\n",counter3);
printf("You Have Chosen option D for: %d\n",counter4);
system("pause");
exit(0);
}
}while(option != 'e');
system("pause");
} (SECOND ERROR HERE)

New Topic/Question
This topic is locked


MultiQuote





|