Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I had posted needing help and I hope to get it worked out, but there is something else I'm desperate for some help. I've been seriously sick with the flu so I could use some help as this script stuff really boggles my mind at times. Below I will post the questions i was needing help with.
tyvm,
Chris
1. Declare a function that is called Compute_Avg. The function returns a float data, receives an integer parameter named “num”, and a float parameter named “Average”.
2. x = 2, y =1, z =3, what is the value of x, y, z after executing the following codes?
switch(x)
{
case 0: x =2; y =3;
case 1: x =3; break;
default: x=3; y=2 ;
}
3. Find any errors in the following function declarations.
a. int sun(int x, y);
b. int sun(int x, int y)
c. void sun(void, void) ;
d void sun(x int, y float);
4. What is the output of the code corresponding to the following pseudocode?
(a)
X = -5;
if (X > 0)
printf(“%d”,X);
if (!((X=0) && (X<0)))
printf(“Not”);
(b)
#include<stdio.h>
#include<stdlib.h>
void print_message(void);
int main()
{
print_message( );
printf(“This is a new message.\n”);
print_message( );
print_message( );
printf(“The end.\n”);
system(“pause”);
return 0;
}
void print_message( )
{
printf(“Hello !\n”);
return;
}
5. If num=5, determine whether each of the following expressions is true or false.
a. (num*num)>=(2*num)
b. (3*num-2)<=6
6. A home mortgage authority requires a deposit on a home loan according to the following schedule:
Loan$ Deposit
Less than $25000 6% of loan value
$25000-$49000 $1000+10% of loan
$49000-$100000 $2000+25% of loan
Loans in excess of $100000 are not allowed. Write a program that will read a loan amount and compute and print the required deposit.
7 Write a program that inputs one number, then display “yes” if num = 1, display “no” if num =2, displays “maybe” if num = 3, display “Error message” if num is not 1,2 or 3. Implement this program by a Switch statement.
8. Write a function float Average(int, int, int, int) that finds the average of four numbers, and then write a main program that inputs four numbers from the user. You need to call the function and display the mean of the four numbers in the main.
The cost of renting a tool is $20 for the first day, $10 per day for the next 3 days and $8 per day thereafter. If the input is the number of days the tool was rented, compute the cost of renting the tool.
You ain't impatient, ain't you? Give it time to go around the world (24 hours).
Please be more clear in what you don't understand. This looks a lot like C (and not scripting) so a book on C (or online tutorials) might be what you need more at this moment than our help
Let me help you with question 2; what does a switch statement do?
Feed a number in it (x); if (initial) x equals 0, case 0 is executed followed by case 1 (because there is no break after case 0). If (initial) x equals 1, case 1 is executed. If x equals something else, the default case is executed.
And for 1 and 3, do a search for C function declaration syntax; I found this one that might be easy to understand: http://en.wikipedia.org/wiki/C_syntax#Syntax but a tutorial somewhere might be better.
Please show us what you coded (for questions that require you to code) and we can help you to fix your code if you don't understand what you do wrong.
Last edited by Wim Sturkenboom; 11-09-2012 at 05:55 AM.
It is homework and not a test,also I am needing help because it's just something I have never fully understood. But also lately i've had to deal with my mother in law and father in law almost dying so I have fallen behind in my work and just need help to catch up that is all.
I am needing help because it's just something I have never fully understood. But also lately i've had to deal with my mother in law and father in law almost dying so I have fallen behind in my work and just need help to catch up that is all.
I'm sorry for all your personal troubles. Maybe you should ask your instructor for extra time.
But that is not a reason to ask us to do your homework for you.
I and others are happy to help if you start by making some effort yourself, but are then confused by specific details. But just posting the original question and asking us to do it for you is wrong. Posting a whole list of original questions is even worse.
Please if anyone can help me with these questions, I've been fine until now and if I can get help I should be ok after.
Ty
Chris
If you want any help at all, the least you could do is post what you have attempted already and asked specific questions. The way you did it looks like you just want someone to do your work for you.
Also, you agreed to LQ rules when you signed up. Here is a refresher of one of the rules:
Quote:
•Do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and searches) and we'll do our best to help. Keep in mind that your instructor might also be an LQ member.
As for this.....
Quote:
But also lately i've had to deal with my mother in law and father in law almost dying so I have fallen behind in my work and just need help to catch up that is all.
Sorry to hear you are having troubles. I do hope things are getting better. I agree with johnsfine's advice though, this would be something to take to your instructor to get more help/time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.