Sponsored Content
Homework and Emergencies Homework & Coursework Questions UNIX script coding HW question Post 302894323 by renegade755 on Monday 24th of March 2014 09:24:18 PM
Old 03-24-2014
UNIX script coding HW question

i am trying to write a script code in unix that will:

1. The problem statement, all variables and given/known data:
display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform chosen operation on those two numbers. The program should keep asking
for choice / numbers unless user chooses ‘G’ for exit.

2. Relevant commands, code, scripts, algorithms:

3. The attempts at a solution (include all code and scripts):


i tried everything to write this code i couldnt



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number
school name: Senaca college, Toronto, Canada, Name of Professor: peter wheeler, and Course Number: Tech 154

Last edited by vbe; 03-25-2014 at 06:22 AM.. Reason: added template...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix Coding Standards

Hi, I am looking for some coding standards for Unix Shell Scripting. Can anyone help me out in this? Regards, Himanshu (3 Replies)
Discussion started by: himanshu_s
3 Replies

2. Shell Programming and Scripting

Shell Coding question for any experts out there

Given this one long stream of data (all one line): <TransactionDetail><TransactionHeader><ErrorLogging>YES</ErrorLogging><HistoryLogging>YES</HistoryLogging><ErrorDetection>NO</ErrorD... (4 Replies)
Discussion started by: dfran1972
4 Replies

3. Shell Programming and Scripting

Coding Standard For Unix Shell Scripting!!!

Is there any site on Coding Standard for Shell Scripting in UNIX. Please help me know!!!!! Thanks Om (1 Reply)
Discussion started by: Omkumar
1 Replies

4. UNIX for Dummies Questions & Answers

Unix coding tip required

Hi! Suppose I am at a location xyz:/abc1/abc2/abc3 Is it possible to move to another location xyz:/mnl1/mnl2/mnl3 by some coding within a script? (5 Replies)
Discussion started by: udiptya
5 Replies

5. Solaris

Getting Started in UNIX - incorporating C coding

I'm just starting a 'serious' coding in UNIX, so what I need is to run a C code on UNIX, What do I have to install (app) prior to coding/running the code and how do I compile that code? can I write my c code in UNIX or I need to have a visual studio for this? (7 Replies)
Discussion started by: Peevish
7 Replies

6. UNIX for Dummies Questions & Answers

Unix coding for triggering informatica

Hi, I have very little knowledge with unix and pmcmd. I need help with a issue. I have to see whether a file has been dropped in a particular location/path. If the file dropped I have to check the last modified time, which should be greater than 8pmEST the prior day. If the file has been... (4 Replies)
Discussion started by: redwolves
4 Replies

7. Shell Programming and Scripting

Need help in shell script coding

I have a file f1.txt that contains string: f1.txt aaa bbb ccc ... I want to write code to search that each string in file f2.txt(this file contains 1000+line codes). file f2.txt .. .. ....aaa...xyz.. ... ... ...ppp... (dots . can be characters ot blank spaces) If particular... (2 Replies)
Discussion started by: Sanchit
2 Replies

8. Shell Programming and Scripting

UNIX script coding help?

Unix script coding help? i am trying to write a code that will display following menu to user: (A) Add (B) Subtract (C) Multiply (D) Divide (E) Modulus (F) Exponentiation (G) Exit Then ask user for choice (A-F). After taking users choice ask user for two numbers and perform... (3 Replies)
Discussion started by: renegade755
3 Replies

9. UNIX for Dummies Questions & Answers

Help with understand shell script coding

Good afternoon everyone, I am very new to UNIX shell scripting and I am trying to understand the following code. I know what it does but I need to modify it so it will allow me to pass a file name as *FILENAME* Thank for any guidance offered. if ] ; then match=`expr "$file" :... (2 Replies)
Discussion started by: Walter Barona
2 Replies

10. What is on Your Mind?

Coding Style at UNIX.com forums

Hi, as I mentioned in this thread(https://www.unix.com/shell-programming-and-scripting/280737-awk-function-return-permutations-n-items-out-m.html), a helpful coding style may improve overall value and support for people who come here and want to learn things the participants from unix.com have... (2 Replies)
Discussion started by: stomp
2 Replies
ARITH3(9.2)															       ARITH3(9.2)

NAME
add3, sub3, div3, mul3, eqpt3, closept3, dot3, cross3, len3, dist3, unit3, midpt3, lerp3, reflect3, nearseg3, pldist3, vdiv3, vrem3, pn2f3, ppp2f3, fff2p3, pdiv4, add4, sub4 - operations on 3-d points and planes SYNOPSIS
#include <libg.h> #include <geometry.h> Point3 add3(Point3 a, Point3 b) Point3 sub3(Point3 a, Point3 b) Point3 div3(Point3 a, double b) Point3 mul3(Point3 a, double b) int eqpt3(Point3 p, Point3 q) int closept3(Point3 p, Point3 q, double eps) double dot3(Point3 p, Point3 q) Point3 cross3(Point3 p, Point3 q) double len3(Point3 p) double dist3(Point3 p, Point3 q) Point3 unit3(Point3 p) Point3 midpt3(Point3 p, Point3 q) Point3 lerp3(Point3 p, Point3 q, double alpha) Point3 reflect3(Point3 p, Point3 p0, Point3 p1) Point3 nearseg3(Point3 p0, Point3 p1, Point3 testp) double pldist3(Point3 p, Point3 p0, Point3 p1) double vdiv3(Point3 a, Point3 b) Point3 vrem3(Point3 a, Point3 b) Point3 pn2f3(Point3 p, Point3 n) Point3 ppp2f3(Point3 p0, Point3 p1, Point3 p2) Point3 fff2p3(Point3 f0, Point3 f1, Point3 f2) Point3 pdiv4(Point3 a) Point3 add4(Point3 a, Point3 b) Point3 sub4(Point3 a, Point3 b) DESCRIPTION
These routines do arithmetic on points and planes in affine or projective 3-space. Type Point3 is typedef struct Point3 Point3; struct Point3{ double x, y, z, w; }; Routines whose names end in 3 operate on vectors or ordinary points in affine 3-space, represented by their Euclidean (x,y,z) coordinates. (They assume w=1 in their arguments, and set w=1 in their results.) Name Description add3 Add the coordinates of two points. sub3 Subtract coordinates of two points. mul3 Multiply coordinates by a scalar. div3 Divide coordinates by a scalar. eqpt3 Test two points for exact equality. closept3 Is the distance between two points smaller than eps? dot3 Dot product. cross3 Cross product. len3 Distance to the origin. dist3 Distance between two points. unit3 A unit vector parallel to p. midpt3 The midpoint of line segment pq. lerp3 Linear interpolation between p and q. reflect3 The reflection of point p in the segment joining p0 and p1. nearseg3 The closest point to testp on segment p0 p1. pldist3 The distance from p to segment p0 p1. vdiv3 Vector divide -- the length of the component of a parallel to b, in units of the length of b. vrem3 Vector remainder -- the component of a perpendicular to b. Ignoring roundoff, we have eqpt3(add3(mul3(b, vdiv3(a, b)), vrem3(a, b)), a). The following routines convert amongst various representations of points and planes. Planes are represented identically to points, by duality; a point p is on a plane q whenever p.x*q.x+p.y*q.y+p.z*q.z+p.w*q.w=0. Although when dealing with affine points we assume p.w=1, we can't make the same assumption for planes. The names of these routines are extra-cryptic. They contain an f (for `face') to indicate a plane, p for a point and n for a normal vector. The number 2 abbreviates the word `to.' The number 3 reminds us, as before, that we're dealing with affine points. Thus pn2f3 takes a point and a normal vector and returns the corresponding plane. Name Description pn2f3 Compute the plane passing through p with normal n. ppp2f3 Compute the plane passing through three points. fff2p3 Compute the intersection point of three planes. The names of the following routines end in 4 because they operate on points in projective 4-space, represented by their homogeneous coordi- nates. pdiv4 Perspective division. Divide p.w into p's coordinates, converting to affine coordinates. If p.w is zero, the result is the same as the argument. add4 Add the coordinates of two points. sub4 Subtract the coordinates of two points. SOURCE
/sys/src/libgeometry SEE ALSO
tstack(9.2) BUGS
Spotty coverage. ARITH3(9.2)
All times are GMT -4. The time now is 12:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy