basic math program 4 child


 
Thread Tools Search this Thread
Top Forums Programming basic math program 4 child
# 1  
Old 10-19-2002
basic math program 4 child

Iam writing a script for my sisters friends little brother

i want the program to say hello lets say his name is Joe and ask him how he is and he can write a reply back saying fine and then it replys "Iam happy you are (his response) today
and then it goes into a basic math where he can put in a number hit enter put in another number and then it tells him the awnser.

Its to work on a win 98 machine and in C or Perl if it has to be
# 2  
Old 10-19-2002
Is there an exact question in there?

Are you asking for the entire answer?

What have you done so far?
# 3  
Old 10-19-2002
iam looking for the whole script.i havnt done anything yet
# 4  
Old 10-20-2002
Ok - I don't know C, but i know the groundwork to Perl - so here's one Perl solution:

Code:
#!/usr/bin/perl

print "\nHello Joe, how are you today? ";
chomp( $feelToday = <STDIN> );

print "\nI am happy you are $feelToday today.";
print "\nLet's do some math. What's your first number? ";
chomp( $firstNumber = <STDIN> );

print "\nWhat's your second number? ";
chomp( $secondNumber = <STDIN> );

$mathResult = $firstNumber + $secondNumber;
print "\nThe math result is $mathResult!\n\n";

Just put it in a script, make it executable and run it. Just make sure the first line points to the location of your Perl executable on your system!

Smilie
# 5  
Old 10-20-2002
it works perfect. Thanks man. Cheers

so now how do i make it a .exe ????? i have perl2exe and how do i use that to make it a exe ?
# 6  
Old 10-20-2002
Sorry, I don't have perl2exe Smilie You'll have to check the docummentation or website
# 7  
Old 10-20-2002
OK - I was in a good mood; The website is:

http://www.indigostar.com/perl2exe.htm


And under the "Documentation" section, it clearly says:

Usage:
perl2exe myscript.pl


So there you go! Now, having done your child's homework; my fee ... <change register sound>
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Log file analyzer, super basic sh program

Hello! I'd like some help with this assignment. 1. The problem statement, all variables and given/known data: 1)Write a shell script that can uses two types of files as inputs, apache.log and apache.error.log 2)Make it so that you can switch between the two file types 3)Make it so that the... (5 Replies)
Discussion started by: malfiory
5 Replies

2. Shell Programming and Scripting

Perl math program

I have this math program on Perl and when I run it one of the math problems that comes up is 0/0 and perl makes the answer 4. How can I program perl to not include numbers /0? What I have for the division portion is: $solution = $num1 * $num2; ($solution, $num1) = ($num1, $solution); $question... (2 Replies)
Discussion started by: germany1517
2 Replies

3. Homework & Coursework Questions

Need help with Basic Unix Program

I am a newbie to UNIX. I'm learning UNIX on my own, just trying to get the jerk of how things work in UNIX environment. I am familiar with Windows environment. Can anyone pls write simple 'envprint' programs to : 1) List all the environment Information (using the -l or --l options) 2) ... (1 Reply)
Discussion started by: agup17
1 Replies

4. What is on Your Mind?

Any ideas on child-control program

My auntie told me that she has been suspecting that her little kids are looking at some "illegal" sites online. She put a free web blocker on the computer, but they might be finding loopholes. She wanna install some child-control program to see what's going on. There are so many since I searched... (5 Replies)
Discussion started by: Bluerosen
5 Replies

5. HP-UX

Program monitor on BT-Basic

Hi, The "program monitor" command in BT-Basic prompt you for a user name and a password. How can I grant access only to certain users ? Thank you. (0 Replies)
Discussion started by: fosiceanu
0 Replies

6. Programming

Basic multithreaded program

I'd like to write a program (I'm flexible on language; C/C++ was my original idea but a scripting language would probably be better) that runs hundreds of programs, but only N = 4 (say) at a time. The idea is to keep all the cores on a multicore machine busy. How can I do this? In particular,... (6 Replies)
Discussion started by: CRGreathouse
6 Replies

7. Programming

parent not waiting until child complete executing another program through execl()

Hi, I am calling a program that greps and returns 72536 bytes of data on STDOUT, say about 7000 lines of data on STDOUT. I use pipe from the program am calling the above program. Naturally, I execute the above program (through execl() ) throught the child process and try to read the... (4 Replies)
Discussion started by: vvaidyan
4 Replies

8. Shell Programming and Scripting

writing math testing program

Can anyone create a program that would test the math skills of the user. Assume that it would test integer addition, The program should ask the question,collect the integer response, evaluate and notify the user if their answer was correct or incorrect. I would assume integers in the range... (5 Replies)
Discussion started by: ccp
5 Replies

9. Shell Programming and Scripting

Having trouble writing a basic shell program

Hello. I'm trying to write a shell script that will take files that have .tar, .tar.gz, .tar.Z, .gz, .Z and .zip file extensions and uncompress and unarchive them. The script should be able to take multiple arguments. So far I can write a script using the case command that will do this but it will... (3 Replies)
Discussion started by: SeanWuzHere
3 Replies
Login or Register to Ask a Question