Sponsored Content
Top Forums Programming Error in executing the C program Post 302928871 by ongoto on Monday 15th of December 2014 09:39:41 PM
Old 12-15-2014
All of the above. These things show up a lot easier when your code is structured and indented correctly. Consider Vi as an editor.

For starters

add some #includes...
#include <stdlib.h> // rand(), srand()
#include <time.h> // time()

Add a return 0; at the end of your methods.
..at or about these lines...approximate
lines: 76, 129, 189, 238, 273
}
return 0;
}


Change return type from void to int in all your functions.
int man_leaves()
{
...
...
int main()
{
...
etc.


Closing brace errors...
line: 124, 230
..too many closing braces.
replace }}} with
}
return 0;
}

...then add closeing brace..
lines: 73, 183
return 0;
}
void man_leaves()
...
return 0;
}
void woman_leaves()


Add parens when mixing && and ||...
line 22, 131
if(( max_queue < 5 && max_bathroom < 5 && women_bathroom > 0 ) || ( women_queue > 0 ))
{
 

10 More Discussions You Might Find Interesting

1. Programming

executing a program within a program

Read the title: how do i do it? (4 Replies)
Discussion started by: Gekko
4 Replies

2. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

3. Programming

Executing an .ec program in different informix versions

Hi all, I tried writing an .ec program connecting to informix database from solaris platform Sun 5.7 informix version that i had to used when i compiled the program was 9.21.UC3 the binary when i ported solaris box with informix version 9.40.UC5 i am unable to run that i am encountering... (0 Replies)
Discussion started by: matrixmadhan
0 Replies

4. Programming

after executing execvp()... program hangs up

Hi , I m actually trying to implement pipes program,but after executing the execvp(),my program is getting hanged up :mad: Actaully i m getting the desired output expected from execvp()...but once results are displayed on the output screen ,program is getting hanged up values of... (3 Replies)
Discussion started by: Crab
3 Replies

5. Programming

Trubble in executing the cpp program...

I wrote a code like this....... #include <iostream> #include <stdio.h> #include <mysql.h> #include <string.h> #include <stdlib.h> using namespace std; #include "Connection.h" int main() { char *Host = (char *)"localhost"; char *Database =(char *)"sachin"; char... (3 Replies)
Discussion started by: ps_sach
3 Replies

6. Solaris

How to know the size of the program currently executing in memory

hey everybody, i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies

7. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

8. Linux

Error while executing Directfb program on ubuntu

Hi , I am getting error while executing Directfb program on ubuntu ,, my program is : #include <stdio.h> #include <unistd.h> #include <directfb.h> static IDirectFB *dfb = NULL; static IDirectFBSurface *primary = NULL; static int screen_width = 0; static int screen_height... (0 Replies)
Discussion started by: Ravikishore
0 Replies

9. Shell Programming and Scripting

Executing WIN32OLE program

Hello, Please help me out to execute this perl program: #!/usr/bin/perl -w use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # die on errors... # get already active Excel application or open new my... (6 Replies)
Discussion started by: suvenduperl
6 Replies

10. UNIX for Dummies Questions & Answers

executing a different program

What system calls or commands do I need to use in order to execute a different program from an already running process? (1 Reply)
Discussion started by: justOne21
1 Replies
cycle(1)							       Utils								  cycle(1)

NAME
cycle - a calendar for women SYNOPSIS
cycle DESCRIPTION
Cycle is a calendar program for women. Given a cycle length or statistics for several periods, it can calculate the days until menstrua- tion, the days of "safe" sex, the fertile period, and the days to ovulations, and define the d.o.b. (date of birth) of a child. It allows the user to write notes and helps to supervise the reception of hormonal contraceptive tablets. FEATURES
The program is capable of: - Calculate of the days of menstruation, based on length of the cycle or on statistics of a period. - Calculate the "safe" sex days, fertile period and day to ovulations - Definition of D.O.B . (Date Of Birth) of a child - Allows to write notes - Helps to supervise reception of hormonal contraceptive tablets HOW DOES IT WORK
It uses the calendar method for the definition of fertile days. For this is necessary to determine duration, at least, of last six cycles. For determine the fertile days it uses this algoritm: - First day: duration of shortest cycle minus 18 - Last day: duration of longest cycle minus 11 - Ovulation: is considered in the middle of fertile period (Determine the exact day isn't possible with the calendar method) Date of a birth of the child is counted from the beginning of last menstruation (in obstetrics are accepted 40 weeks). This date is cor- rected with the duration of a cycle (are subtracted or added same number of days that a cycle differs from 28 days). Is possible check the results at: http://cir.msk.ru/sroki.shtml (in Russian) USAGE
It is necessary to mark the beginning of menstruation. This is possible clicking with the right button on the date and chosing "The begin- ning of a cycle". Similarly the mark can be removed. Using duration of last six cycles, the program will calculate - Fertile period - green cells - Ovulation day (the middle fertile period) - brightly green cell - Beginning of following menstruation - pink cells Cycle duration is set in options or is calculated an average of last six periods. To determine prospective date of a birth of the child, it is necessary first day of last cycle to mark in addition as "Pregnancy". Depending on your purposes, you can display only "Safe" sex days or only fertile days. Information about interesting day can be received clicking with left button. Is possible adding a note to any date using corresponding item of the menu. Day with a note are underlined. It is necessary to note that factor of failures of calendar contraception method is about 10 percent. This method is suitable only for women with enough regular cycle. If your doctor has recommended hormonal contraceptive this program will help to supervise their reception. Closely familiarize with the instruction applied to the chosen preparation. Packing can contain 21 tablet (the circuit of reception 21 day on one tablet, then 7 days pause) or 28 tablets in this case all tablets are accepted without interruption every day of 28. In the program, is marked only day of reception of each first tablet of packing. NOTE: This program is not a reliable contraceptive method. It does neither help to prevent sexual transmision diseases like AIDS. It is just an electronic means of keeping track of some of your medical data and extract some statistical conclusions from them. You cannot con- sider this program as a substitute for your gynecologist in any way. FILES
~/.cycle This is the directory where cycle stores the data. AUTHOR
cycle was written by Oleg S. Gints. This manual page was written for Debian by Miriam Ruiz <little_miry@yahoo.es>. SEE ALSO
You can find cycle's home page at: http://cycle.sourceforge.net/ More information about calendar method are available at: http://www.mama.ru/gynecolog/STA/st18.htm (in Russian) Miriam Ruiz 6 April 2005 cycle(1)
All times are GMT -4. The time now is 05:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy