Jump to content

I Really Need Your Help To Solve This Assignment

- - - - -

  • Please log in to reply
4 replies to this topic

#1
zongi

zongi

    Newbie

  • Members
  • Pip
  • 2 posts
Guyz I hv This Assignment That I Really Need Help With, the qu'z are above and you are required to use c program.
Qu 1
Write a program to model a simple calculator. You program should accept a pair of integers
(operands) and operators [addition / subtraction / multiplication / division and power (^)].
Design the output to display the entered values and the result of the arithmetic operations.
Your program should continue until users decide to quit and should display invalid data
entry messages.

Qu2
Write a program to process a collection of daily high temperatures. Your program should
count and print the number of hot days, the number of pleasant days and the number of
cold days. It should also display the category of each temperature. You should design the
category and the range of temperatures for each category. Print invalid data entry message
and prompt user to enter the valid input again.

And cld you make as simple as you can.Thx
something like
http://forum.codecal...calculator.html

Edited by dargueta, 21 April 2011 - 10:07 AM.
Dude...the fonts...


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
What do you have so far?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Megak

Megak

    Newbie

  • Members
  • PipPip
  • 16 posts
I believe he just wants you to do the assignment for him...

#4
zongi

zongi

    Newbie

  • Members
  • Pip
  • 2 posts
Qu 1

#include <stdio.h>

int main()
{

    float num1, num2;
    char operation;
    while (1) 
    {
        scanf("%f%c%f", &num1, &operation, &num2);
        if (operation == '+')
            printf("%f\n", num1+num2);
        if (operation == '-')
            printf("%f\n", num1-num2);
        if (operation == '*')
            printf("%f\n", num1*num2);
        if (operation == '/')
            printf("%f\n", num1/num2);
    }
    return 0;
}
This is wat I've done for qu 1, but I have no idea how to do qu 2, so cld check it out.
Add to that I didn't knw hw to do this condition for qu1
Your program should continue until users decide to quit and should display invalid data
entry messages.

Edited by WingedPanther, 20 April 2011 - 04:02 PM.
add code tags (the # button)


#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
It looks like for q1, you just really need to add support for 2^3, and make sure your output is correct for the requirements.

For q2: start by deciding what is a "hot" day, what is "pleasant", and what is "cold".
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users