convert to shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting convert to shell script
# 1  
Old 04-25-2012
convert to shell script

how to convert these code to shell script

Code:
#include<stdio.h>
#include<conio.h>
main()
{
int
i,j,a=0,b=0,c=0,f[10],t[10][10],al[10][10],ta[10][10];
int a1[10][10], max[10][10], n[10][10], n1,p,k=0;
printf(“\n enter no.of resources”);
scanf(“%d”,n1);
printf(“\nenter the max no .of resources for each type”);
for(i=0;i<n1;i++)
scanf(“%d”,&t[b][i]);
printf(“\nenter no .of process”);
scanf(“%d”,&p);
printf(“\nenter allocation resources”);
for(i=0;i<p;i++)
{
f[i]=0;
for(j=0;j<n1;j++)
scanf(“%d”,&a1[i][j]);
}
for(i=0;i<p;i++)
for(j=0;j<n1;j++)
{
if(a1[i][j]<=t[b][j])
{
t[b][j]+=a1[i][j];
continue;
}
else
printf(“\n wrong resourcesallocation”);

# 2  
Old 04-25-2012
not easy

this is a c program,
i am not really aware of any requirement any one will have.

but you can check : CCsh, The Bourne Shell Compiler
*Remember its not free

there may be something free but will be full proof, no idea. someone else can say beter.
# 3  
Old 04-25-2012
@ajayya*
That is the other way around, no?
Quote:
What exactly is CCsh?

CCsh is a high quality programming tool that will transform your current Bourne Shell code into C language source code
CCsh, The Bourne Shell Compiler: What exactly is CCsh?

--
@syah, this cannot be done in an automated form. Why would you want this, is this homework?

Last edited by Scrutinizer; 04-25-2012 at 05:40 AM..
# 4  
Old 04-25-2012
ya.. homework
# 5  
Old 04-25-2012
Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to convert rows into cloumns

B010215861628 MA 01020 CARRIER B010215861695 MA 01020 CARRIER B010215861709 MA 01020 CARRIER My output is in the above format I want the output to be: (4 Replies)
Discussion started by: Teegela Prathyu
4 Replies

2. Shell Programming and Scripting

Shell script to convert rows to columns

Hi I have a file having the values like below ---------------------------- .set A col1=”ABC” col2=34 col3=”DEF” col4=”LMN” col5=25 .set A .set B col1=55 col3=”XYZ” col4=”PQR” col5=66 .set B .set C col2=”NNN” (1 Reply)
Discussion started by: Suneel Mekala
1 Replies

3. Shell Programming and Scripting

Convert my shell script to C programming HELP!!

I had try to create a basic shell script. So now im trying to convert in to C-programming language can some one guide/help me out with it?(BTW IM USING A LINUX/UNIX/ORACLE SYSTEM) CODE BELOW !/bin/bash for i in `ls -1 /cslab/home/JAZEL/` do cp -uv $i /cslab/home/JAZEL/cs295/$i.`date... (2 Replies)
Discussion started by: Nygenesis
2 Replies

4. Shell Programming and Scripting

Convert shell script to Perl

Hello,,I have a very small script that contains these lines; and it works perfectly; however I need to use Perl now as I will need to feel variables from a MySQL table into this; to it would be nice to start by converting this first... find / -perm 777 \( -type f -o -type d \) -exec ls -lid {}... (1 Reply)
Discussion started by: gvolpini
1 Replies

5. Red Hat

May you convert vbscript to shell script?

Dear! I've a script (vbscript) running on windows machine for along time ago. 2 weeks ago, we changed server from Windows to RHEL5, and this script did not run, and I'm not programmer. So that, I post this script here and wish you convert for me. vbscript code: 'This script will: ' - ZIP... (1 Reply)
Discussion started by: trantuananh24hg
1 Replies

6. Shell Programming and Scripting

how to convert a shell script to a php script for displaying next word after pattern match

I have a shell script which I made with the help of this forum #!/bin/sh RuleNum=$1 cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}' Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies

7. Shell Programming and Scripting

please convert the below program into shell script

if ( ( grep -i "Exception : " /home/dklog* )) then echo " improper combination" elsif ( ( grep -i "invalid" /home/dklog*)) then echo " wrong process " fi fi in the above case i am facing the the syntx error please help in this case... (3 Replies)
Discussion started by: mail2sant
3 Replies

8. UNIX for Advanced & Expert Users

Shell script to convert to Title case

I need a shell script which will convert the given string to Title case. E.g "hi man" to "Hi man" (5 Replies)
Discussion started by: SankarV
5 Replies

9. Shell Programming and Scripting

Convert shell script for looping

Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter (obviously), but I would like to add other workstations to this script as they... (4 Replies)
Discussion started by: le0pard13
4 Replies

10. Shell Programming and Scripting

C Shell Script to convert a number into minutes

Could anyone tell me how to write a C shell script according to the following requirement. Write a C shell script convertmin which will read in a number, thought of as representing minutes, and print out the number of hours/minutes it represents so: Note: you are required to check exception... (1 Reply)
Discussion started by: Ringo
1 Replies
Login or Register to Ask a Question