Here is my code. There are Two C Programs which need to follow the above format
TexttoBinary.C
#include
#include
int main() {
FILE *fpIn, *fpOut;
fpIn = fopen(\"TextToBinaryInput.txt\", \"r\");
fpOut = fopen(\"TextToBinaryOutput.txt\", \"wb\");
char firstName[255], lastName[255];
unsigned int id;
float gpa;
unsigned char firstLength, lastLength;
while(!feof(fpIn)){
fscanf(fpIn, \"%s%s%u%f\", firstName, lastName, &id, &gpa);
//printf(\"%s %s %u %f\ \", firstName, lastName, id, gpa);
firstLength = strlen(firstName);
lastLength = strlen(lastName);
fwrite(&firstLength, 1, 1, fpOut);
fwrite(firstName, 1, firstLength, fpOut);
fwrite(&lastLength, 1, 1, fpOut);
fwrite(lastName, 1, lastLength, fpOut);
fwrite(&id, 4, 1, fpOut);
fwrite(&gpa, 4, 1, fpOut);
}
fclose(fpIn);
fclose(fpOut);
}
BinarytoText.C
#include
#include
#include
//stdtent data type to store info
struct student
{
char firstname[255],lastname[255];
unsigned int id;
float gpa;
};
//function prototypes
int longestName(struct student data[],int n);
int shortestName(struct student data[],int n);
int highestId(struct student data[],int n);
int lowestId(struct student data[],int n);
int highestGPA(struct student data[],int n);
int lowestGPA(struct student data[],int n);
////////////////////
int main()
{
struct student data[20]; // array of student
int n,i;
float tgpa;
FILE *fp,*fout;
int longestname,shortestname;
int highestid,lowestid;
int highestgpa,lowestgpa;
fp=fopen(\"bina.dat\",\"rb\"); // open the binary file
if(fp==NULL)
{
printf(\"Unable to open file\");
exit(0);
}
fout=fopen(\"tex.txt\",\"w\"); //open the text file
n=0;
//scan the binary file continiously and store the data in text file as well as in array of student
structure
while(fscanf(fp,\"%s%s%d%f\",data[n].firstname,data[n].lastname,&data[n].id,&tgpa)!=EOF)
{
data[n].gpa=tgpa;
fprintf(fout,\"%s\\t%s\\t%d\\t%0.2f\ \",data[n].firstname,data[n].lastname,data[n].id,tgpa);
n++;
}
// print the data
for(i=0;imaxlen)
{
maxlen=strlen(data[i].firstname)+strlen(data[i].firstname);
index=i;
}
}
return index;
}
// returns the index of student having shortest name
int shortestName(struct student data[],int n)
{
int i,minlen,index=0;
minlen=strlen(data[0].firstname)+strlen(data[0].lastname);
for(i=1;imax)
{
max=data[i].gpa;
index=i;
}
}
return index;
}
// returns the index of student having lowest id
int lowestId(struct student data[],int n)
{
int i,min,index=0;
min=data[0].id;
for(i=1;imax)
{
max=data[i].id;
index=i;
}
}
return index;
}
// returns the index of student having lowest gpa
int lowestGPA(struct student data[],int n)
{
int i,min,index=0;
min=data[0].gpa;
for(i=1;i
Solution
Steps to Compile using gcc compiler on linux platform:
#1. gcc main.c binarytotext.c texttobinary.c [this will make a.out executable]
#2. ./a.out [we can run a.out in this way]
Note: Calling sequence of binaryToText_main() and textToBinary_main() depends on your
functionality.
----------------------
File#1 [main.c]
----------------------
#include \"header.h\"
in.
C Programming Projects -
1. Sort an array in ascending order.
2. Display sum of all odd values stored in an array.
3. Display number of even values stored in an array.
--
1. A file name is command line argument. Display the contents of the file where each word will be displayed on a new line. Display proper message if file does not exist.
2. Display no. of vowels stored in the file.
3. Display no. of “the” stored in the file.
4. Copy contents of the file to another file.
C Programming Projects -
1. Sort an array in ascending order.
2. Display sum of all odd values stored in an array.
3. Display number of even values stored in an array.
--
1. A file name is command line argument. Display the contents of the file where each word will be displayed on a new line. Display proper message if file does not exist.
2. Display no. of vowels stored in the file.
3. Display no. of “the” stored in the file.
4. Copy contents of the file to another file.
httplinux.die.netman3execfork() creates a new process by.docxadampcarr67227
http://linux.die.net/man/3/exec
fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate of the calling process, referred to as the parent#include <unistd.h>pid_t fork(void);
The exec() family of functions replaces the current process image with a new process image. The functions described in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further details about the replacement of the current process image.)
The exec() family of functions include execl, execlp, execle, execv, execvp, and execvpe to execute a file.
The ANSI prototype for execl() is:
int execl(const char *path, const char *arg0,..., const char *argn, 0)
http://www.cems.uwe.ac.uk/~irjohnso/coursenotes/lrc/system/pc/pc4.htm #inciude <stdio.h> #inciude <unistd.h> main() { execl("/bin/ls", "ls", "-l", 0); printf("Can only get here on error\n"); }
The first parameter to execl() in this example is the full pathname to the ls command. This is the file whose contents will be run, provided the process has execute permission on the file. The rest of the execl() parameters provide the strings to which the argv array elements in the new program will point. In this example, it means that the ls program will see the string ls pointed to by its argv[0], and the string -l pointed to by itsargv[1]. In addition to making all these parameters available to the new program, the exec() calls also pass a value for the variable: extern char **environ;
This variable has the same format as the argv variable except that the items passed via environ are the values in the environment of the process (like any exported shell variables), rather than the command line parameters. In the case of execl(), the value of the environ variable in the new program will be a copy of the value of this variable in the calling process.
The execl() version of exec() is fine in the circumstances where you can ex-plicitly list all of the parameters, as in the previous example. Now suppose you want to write a program that doesn't just run ls, but will run any program you wish, and pass it any number of appropriate command line parameters. Obviously, execl() won't do the job.
The example program below, which implements this requirement, shows, however, that the system call execv() will perform as required: #inciude <stdio.h> main(int argc, char **argv) { if (argc==1) { printf("Usage: run <command> [<paraneters>]\n"); exit(1) } execv(argv[l], &argv[1)); printf("Sorry... couldn't run that!\n"); }
The prototype for execv() shows that it only takes two parameters, the first is the full pathname to the command to execute and the second is the argv value you want to pass into the new program. In the previous example this value was derived from the argv value passed into the run command, so that the run command can take the command line parameter values you pass it and just pass them on. int execl(.
Write a C++ program 1. Study the function process_text() in file.pdfjillisacebi75827
Write a C++ program
1. Study the function process_text() in file \"text_processing.cpp\". What do the string member
functions find(), substr(), c_str() do?
//text_processing.cpp
#include \"util.h\"
#include \"text_processing.h\"
#include
using namespace std;
int process_text( fstream &ifs, fstream &ofs, char target[] )
{
string replace_str( \"XXX\" ); //hard-coded string for replacement
int tlen = strlen( target ); //string length of target
int max_len = 200; //maximum length of a line
char s[max_len+1];
clear_screen(); //clear the screen
while ( !ifs.eof() ) {
int i2, i1 = 0, len=0;
ifs.getline( s, max_len ); //get one line from file
string str( s ); //construct a string object
i2 = str.find ( target, i1 ); //find target
len = i2 - i1;
if ( i2 > -1 && len > 0 ){ //if target found
print_text( str.substr( i1, i2 ).c_str() ); //print up to target
ofs << str.substr( i1, i2 );
}
while ( i2 > -1 ) {
print_text_inverse ( target ); //highlight target
ofs << replace_str;
i1 = i2 + tlen; //new search position
i2 = str.find ( target, i1 ); //find next target
len = i2 - i1;
if ( i2 > -1 && len > 0 ){ //found target
print_text( str.substr( i1, len ).c_str() ); //print up to target
ofs << str.substr( i1, len );
}
}
len = str.length() - i1;
if ( len > 0 ) { //print the remainder
print_text( str.substr( i1, len ).c_str() );
ofs << str.substr( i1, len );
}
ofs << endl;
getnstr( s, 1 ); //prompt for
} //while ( !ifs.eof() )
restore_screen(); //restore the old screen
return 1;
}
//text_processing.h
#ifndef TEXT_PROCESSING_H
#define TEXT_PROCESSING_H
#include
#include
using namespace std;
int process_text( fstream &ifs, fstream &ofs, char target[] );
#endif
//util.h
#ifndef UTIL_H
#define UTIL_H
#include
#include
#include
#include
#include
using namespace std;
void usage ( char program_name[] );
void clear_screen();
void print_text( const char *s );
void print_text_inverse( const char *s );
void get_input_text( char *s, int max_len );
void restore_screen();
#endif
//util.cpp
#include \"util.h\"
void usage ( char program_name[] )
{
cout << \"Usage: \" << program_name << \" infile outfile search_string\" << endl;
return;
}
/*
The following are some curses functions. You can find
the details by the command \"man ncurses\". But its use
can be transparent to you.
*/
void clear_screen()
{
initscr();
scrollok ( stdscr, true ); //allow window to scroll
}
void print_text ( const char *s )
{
printw(\"%s\", s );
refresh();
}
void print_text_inverse( const char *s )
{
attron( A_REVERSE );
printw(\"%s\", s );
attroff( A_REVERSE );
refresh();
}
void get_input_text( char *s, int max_len )
{
getnstr( s, max_len );
}
void restore_screen()
{
endwin();
}
//str_main.cpp
#include \"util.h\"
#include \"text_processing.h\"
#include
using namespace std;
/*
Note that grace_open() must be defined in same file
as main(), otherwise the destructor of fstream will
automatically close the opened file as it finds that
its out of scope upon exiting the function.
*/
int grace_open( char *s, fst.
IN C++ languageWrite a simple word processor that will accept text.pdfaratextails30
IN C++ language
Write a simple word processor that will accept text and commands as input. The commands it
should respond to are:
Substitute/oldstring/newstring/
Copy #
Locate/string/
Delete #
Move #
Type #
Pastes Insert #
Replace #
Quit
The program should be able to open an existing file or create a new one. It should keep track of
where the user is in the file at any time. Each command is followed by a number which indicates
the number of line (the current line & those following) upon which the command should act.
Each command should operate on the specified line or lines of the file.
Solution
#include
#include
#include
#include
using namespace std;
const bool DEBUG = false;
const int MAX = 100;
struct file // This contains the file information and contents
{
string contents[MAX];
string fileName;
int currentLineIndex;
int total;
bool markupHighlighting;
};
int NumberInputReader(string); // Reads the numbers from user input
void Help(); // Prints out a help menu
void Markup(file&, int); // Does HTML highlighting
void MarkupApply(file&, string, int); // Applies the HTML highlighting to the file
//void Substitute(file&, string); // substitutes portions of lines of text
//void Type(file&, int); // prints text to the screen
//void Copy(file, string[], int&); // copies text
//void Paste(file&, string[], int, int); // pastes text
//void Locate(file &, string); // finds text
//void Insert(file &, int); // inputs text to the array
//void Delete(file &, int); // deletes text
//void Replace(file &, int); // replaces while lines of text text
//void Move(file &, int); // moves the current line
//void Quit(file); // quits the program, asks the users if they want to save.
void Open(file &); // allows the user to open a file
void New(file &); // allows the user to create a file
void Save(file); // saves the array to a file.
void IndexPrint(file); // for debugging, this prints the contents of the array.
int main() // Main program
{
file txtFile;
txtFile.currentLineIndex=-1;
txtFile.total=0;
int inputValue=0, copyNumber;
string inputString, openYN, copyQue[MAX];
char inputChar, openYNtemp;
// ANIMATION LOOP GOES HERE
cout<<\"~~~\\033[1;32m Welcome \\033[0m~~~\ \"; // first use of colors in the program
cout<<\"Would you like to open an existing file? \"
<\'
Markup(txtFile, inputValue);
break;
case \'>\': // Unhighlight
txtFile.markupHighlighting=false; // if false, it\'ll go through the motions
Markup(txtFile, inputValue); // again, but revert to the original array
break; // afterward.
case \'*\': // * saves file to disk
Save(txtFile);
break;
case \'?\':
Help(); // \"I seem to be having difficulty with my lifestyle.\" -Arthur Dent
break;
case\'.\': // default for re-looping
break;
default:
cout<<\"\\033[1;31m\'\"< total: \"< currentLineIndex: \"<=80) // If it takes up the
entire default width of
{ // the window.
cout<<\"\\033[1;31m-That\'s a very long command, \"
<<\"I\'m just but a humble Line Editor.-\\033[0m \"<=8)
{
inputColor=0; // Default color
cout<<\.
This presentation, at the 1st Perl Conference, introduced cross platform perl/unix web development. Of special interest was the examination of what are now called database sockets. This may have been the first presentation of the subject.
You are the CIO of a medium size company tasked with modernizing the.pdffcaindore
Why might you want to look at a path other than the courts? In negotiation and mediation a
middle ground is attempted to be found. Arbitration is more like private court with both parties
pleading the case before a neutral third party. Please explain which form you would want to use
in each dispute listed below and why. 1. Contract dispute between 2 parties. 2. Insurance claim
between one person and their insurance company. 3. Insurance claim between you and someone
else\'s insurance company. 4. A claim between you and a company over liability for injuries
sustained in their store.
Solution
Answer:
We might want to look at a path other than court, to have speedy resolution of the problem by
direct negotiation and mediation with the involved parties..
Why are some goods only provided by the government Why are .pdffcaindore
When asked to create a program to find the volume of any cone, given its radius and height, a
programmer created this program to implement the formula V = 1/3 pi r^2 h. Compute the
following to correct the program: Provide the correct parameters for the Compute Volume
function Write the call for the function in into main Define the Compute Volume function
Initialize any other necessary variables
Solution
Here goes the required Program for the question
Program:
#include
using namespace std;
void ComputeVolume(double &r,double &h,double &a);
int main(){
double radius,height,answer;
cout<<\"Input the radius and height of the cone\"<>radius>>height;
cout<<\" Radius : \"<.
More Related Content
Similar to Here is my code. There are Two C Programs which need to follow the a.pdf
httplinux.die.netman3execfork() creates a new process by.docxadampcarr67227
http://linux.die.net/man/3/exec
fork() creates a new process by duplicating the calling process. The new process, referred to as the child, is an exact duplicate of the calling process, referred to as the parent#include <unistd.h>pid_t fork(void);
The exec() family of functions replaces the current process image with a new process image. The functions described in this manual page are front-ends for execve(2). (See the manual page for execve(2) for further details about the replacement of the current process image.)
The exec() family of functions include execl, execlp, execle, execv, execvp, and execvpe to execute a file.
The ANSI prototype for execl() is:
int execl(const char *path, const char *arg0,..., const char *argn, 0)
http://www.cems.uwe.ac.uk/~irjohnso/coursenotes/lrc/system/pc/pc4.htm #inciude <stdio.h> #inciude <unistd.h> main() { execl("/bin/ls", "ls", "-l", 0); printf("Can only get here on error\n"); }
The first parameter to execl() in this example is the full pathname to the ls command. This is the file whose contents will be run, provided the process has execute permission on the file. The rest of the execl() parameters provide the strings to which the argv array elements in the new program will point. In this example, it means that the ls program will see the string ls pointed to by its argv[0], and the string -l pointed to by itsargv[1]. In addition to making all these parameters available to the new program, the exec() calls also pass a value for the variable: extern char **environ;
This variable has the same format as the argv variable except that the items passed via environ are the values in the environment of the process (like any exported shell variables), rather than the command line parameters. In the case of execl(), the value of the environ variable in the new program will be a copy of the value of this variable in the calling process.
The execl() version of exec() is fine in the circumstances where you can ex-plicitly list all of the parameters, as in the previous example. Now suppose you want to write a program that doesn't just run ls, but will run any program you wish, and pass it any number of appropriate command line parameters. Obviously, execl() won't do the job.
The example program below, which implements this requirement, shows, however, that the system call execv() will perform as required: #inciude <stdio.h> main(int argc, char **argv) { if (argc==1) { printf("Usage: run <command> [<paraneters>]\n"); exit(1) } execv(argv[l], &argv[1)); printf("Sorry... couldn't run that!\n"); }
The prototype for execv() shows that it only takes two parameters, the first is the full pathname to the command to execute and the second is the argv value you want to pass into the new program. In the previous example this value was derived from the argv value passed into the run command, so that the run command can take the command line parameter values you pass it and just pass them on. int execl(.
Write a C++ program 1. Study the function process_text() in file.pdfjillisacebi75827
Write a C++ program
1. Study the function process_text() in file \"text_processing.cpp\". What do the string member
functions find(), substr(), c_str() do?
//text_processing.cpp
#include \"util.h\"
#include \"text_processing.h\"
#include
using namespace std;
int process_text( fstream &ifs, fstream &ofs, char target[] )
{
string replace_str( \"XXX\" ); //hard-coded string for replacement
int tlen = strlen( target ); //string length of target
int max_len = 200; //maximum length of a line
char s[max_len+1];
clear_screen(); //clear the screen
while ( !ifs.eof() ) {
int i2, i1 = 0, len=0;
ifs.getline( s, max_len ); //get one line from file
string str( s ); //construct a string object
i2 = str.find ( target, i1 ); //find target
len = i2 - i1;
if ( i2 > -1 && len > 0 ){ //if target found
print_text( str.substr( i1, i2 ).c_str() ); //print up to target
ofs << str.substr( i1, i2 );
}
while ( i2 > -1 ) {
print_text_inverse ( target ); //highlight target
ofs << replace_str;
i1 = i2 + tlen; //new search position
i2 = str.find ( target, i1 ); //find next target
len = i2 - i1;
if ( i2 > -1 && len > 0 ){ //found target
print_text( str.substr( i1, len ).c_str() ); //print up to target
ofs << str.substr( i1, len );
}
}
len = str.length() - i1;
if ( len > 0 ) { //print the remainder
print_text( str.substr( i1, len ).c_str() );
ofs << str.substr( i1, len );
}
ofs << endl;
getnstr( s, 1 ); //prompt for
} //while ( !ifs.eof() )
restore_screen(); //restore the old screen
return 1;
}
//text_processing.h
#ifndef TEXT_PROCESSING_H
#define TEXT_PROCESSING_H
#include
#include
using namespace std;
int process_text( fstream &ifs, fstream &ofs, char target[] );
#endif
//util.h
#ifndef UTIL_H
#define UTIL_H
#include
#include
#include
#include
#include
using namespace std;
void usage ( char program_name[] );
void clear_screen();
void print_text( const char *s );
void print_text_inverse( const char *s );
void get_input_text( char *s, int max_len );
void restore_screen();
#endif
//util.cpp
#include \"util.h\"
void usage ( char program_name[] )
{
cout << \"Usage: \" << program_name << \" infile outfile search_string\" << endl;
return;
}
/*
The following are some curses functions. You can find
the details by the command \"man ncurses\". But its use
can be transparent to you.
*/
void clear_screen()
{
initscr();
scrollok ( stdscr, true ); //allow window to scroll
}
void print_text ( const char *s )
{
printw(\"%s\", s );
refresh();
}
void print_text_inverse( const char *s )
{
attron( A_REVERSE );
printw(\"%s\", s );
attroff( A_REVERSE );
refresh();
}
void get_input_text( char *s, int max_len )
{
getnstr( s, max_len );
}
void restore_screen()
{
endwin();
}
//str_main.cpp
#include \"util.h\"
#include \"text_processing.h\"
#include
using namespace std;
/*
Note that grace_open() must be defined in same file
as main(), otherwise the destructor of fstream will
automatically close the opened file as it finds that
its out of scope upon exiting the function.
*/
int grace_open( char *s, fst.
IN C++ languageWrite a simple word processor that will accept text.pdfaratextails30
IN C++ language
Write a simple word processor that will accept text and commands as input. The commands it
should respond to are:
Substitute/oldstring/newstring/
Copy #
Locate/string/
Delete #
Move #
Type #
Pastes Insert #
Replace #
Quit
The program should be able to open an existing file or create a new one. It should keep track of
where the user is in the file at any time. Each command is followed by a number which indicates
the number of line (the current line & those following) upon which the command should act.
Each command should operate on the specified line or lines of the file.
Solution
#include
#include
#include
#include
using namespace std;
const bool DEBUG = false;
const int MAX = 100;
struct file // This contains the file information and contents
{
string contents[MAX];
string fileName;
int currentLineIndex;
int total;
bool markupHighlighting;
};
int NumberInputReader(string); // Reads the numbers from user input
void Help(); // Prints out a help menu
void Markup(file&, int); // Does HTML highlighting
void MarkupApply(file&, string, int); // Applies the HTML highlighting to the file
//void Substitute(file&, string); // substitutes portions of lines of text
//void Type(file&, int); // prints text to the screen
//void Copy(file, string[], int&); // copies text
//void Paste(file&, string[], int, int); // pastes text
//void Locate(file &, string); // finds text
//void Insert(file &, int); // inputs text to the array
//void Delete(file &, int); // deletes text
//void Replace(file &, int); // replaces while lines of text text
//void Move(file &, int); // moves the current line
//void Quit(file); // quits the program, asks the users if they want to save.
void Open(file &); // allows the user to open a file
void New(file &); // allows the user to create a file
void Save(file); // saves the array to a file.
void IndexPrint(file); // for debugging, this prints the contents of the array.
int main() // Main program
{
file txtFile;
txtFile.currentLineIndex=-1;
txtFile.total=0;
int inputValue=0, copyNumber;
string inputString, openYN, copyQue[MAX];
char inputChar, openYNtemp;
// ANIMATION LOOP GOES HERE
cout<<\"~~~\\033[1;32m Welcome \\033[0m~~~\ \"; // first use of colors in the program
cout<<\"Would you like to open an existing file? \"
<\'
Markup(txtFile, inputValue);
break;
case \'>\': // Unhighlight
txtFile.markupHighlighting=false; // if false, it\'ll go through the motions
Markup(txtFile, inputValue); // again, but revert to the original array
break; // afterward.
case \'*\': // * saves file to disk
Save(txtFile);
break;
case \'?\':
Help(); // \"I seem to be having difficulty with my lifestyle.\" -Arthur Dent
break;
case\'.\': // default for re-looping
break;
default:
cout<<\"\\033[1;31m\'\"< total: \"< currentLineIndex: \"<=80) // If it takes up the
entire default width of
{ // the window.
cout<<\"\\033[1;31m-That\'s a very long command, \"
<<\"I\'m just but a humble Line Editor.-\\033[0m \"<=8)
{
inputColor=0; // Default color
cout<<\.
This presentation, at the 1st Perl Conference, introduced cross platform perl/unix web development. Of special interest was the examination of what are now called database sockets. This may have been the first presentation of the subject.
You are the CIO of a medium size company tasked with modernizing the.pdffcaindore
Why might you want to look at a path other than the courts? In negotiation and mediation a
middle ground is attempted to be found. Arbitration is more like private court with both parties
pleading the case before a neutral third party. Please explain which form you would want to use
in each dispute listed below and why. 1. Contract dispute between 2 parties. 2. Insurance claim
between one person and their insurance company. 3. Insurance claim between you and someone
else\'s insurance company. 4. A claim between you and a company over liability for injuries
sustained in their store.
Solution
Answer:
We might want to look at a path other than court, to have speedy resolution of the problem by
direct negotiation and mediation with the involved parties..
Why are some goods only provided by the government Why are .pdffcaindore
When asked to create a program to find the volume of any cone, given its radius and height, a
programmer created this program to implement the formula V = 1/3 pi r^2 h. Compute the
following to correct the program: Provide the correct parameters for the Compute Volume
function Write the call for the function in into main Define the Compute Volume function
Initialize any other necessary variables
Solution
Here goes the required Program for the question
Program:
#include
using namespace std;
void ComputeVolume(double &r,double &h,double &a);
int main(){
double radius,height,answer;
cout<<\"Input the radius and height of the cone\"<>radius>>height;
cout<<\" Radius : \"<.
When a supervisor comes to the HR manager to evaluate disciplinary a.pdffcaindore
What is the main purpose of a project management plan?
Solution
1.The main purpose of a project plan is to forecast the number of dangers and problems
viablely,to idea and assemble and manage projects .hence the project may finish wanted results
feasibely without problems.
2.To tell the every crucial activity and to analyse the duration and capital needed to finish the
project ,form a timetable,estimate the endanger.
3.it tells how the project is completed,managed and detectored ..
What is the role of an ethical leader in corporate cultures a. A le.pdffcaindore
What is the difference between a balanace sheet and a net income sheet?
Solution
Difference between Balance sheet and Net income sheet
(i) Contents- Balance sheet contains assets and liabilities of the business whereas Income sheet
contains expenses, losses, incomes and gains of the business.
(ii) Time period- Balance sheet is prepared as at a particular date i.e at the end of a quarter, half
year or a year but income statement is prepared for a particular time i.e. for a quarter, half year or
a year.
(iii) Results- Balance sheet shows financial status of the business at a particular date i.e. what the
firm owns and owes wheras income statement shows trading results of the business for a
particular time period.
(iv) Ratios- Liquidity and solvency ratios like current ratio, liquid ratio, debt equity ratio, debt
ratio etc. can be calculated from the balance sheet whereas profitability and turnover ratios like
Gross profit ratio, net profit ratio, Inventory turnover ratio etc can be calculated from the income
statement.
(v) Alternate names- Balance sheet is also known as statement of financial position or position
statement whereas Income statement is also known as Profit and loss statement..
What is the main purpose of a project management planSolution.pdffcaindore
What is involved in personalization and codification of tacit to explicit knowledge?
Solution
Below is what is involved in conversion of tacit knowledge to explicit knowledge -
1. Social skills are innate but can be imparted to an extent through events,social gatherings and
increased involvement in teams and groups.
2. Documentation and training
3. Codification of tacit knowledge through various scales
4. Creating levels which range from low to high in the importance of tacit knowledge and its
impact.
What is the difference between a balanace sheet and a net income she.pdffcaindore
What happens to the field of view in a compound light microscope when the total magnification
is increased? Why?
Solution
In compound microscope, the field of view(FOV) become decreases when total magnification is
increased.
It is happen because :-
The diameter of the field in an optical microscope is expressed by the field-of-view number. This
means how much of a specimen is visible at any given time in the lateral plane. It is
perpendicular to the optical axis.
FOV is inversely proportional to the magnification which means when the magnification
increases, the FOV decreases. The size of the FOV or the diameter of the visible circle of light is
equal to the field number (FN) of the eyepiece which divided by the magnification of the
objective lens (measured in millimeters).
Field of View = Field Number (fn) / Objective Magnification (Mo)
This means the specimen appears larger with a higher magnification because a smaller area of
the object is spread out to cover the field of view of our eye..
What is involved in personalization and codification of tacit to exp.pdffcaindore
What do you understand by \"emitter efficiency\" and \"transport factor in the base\" in a BJT?
What is the origin of \"Current Crowding\" and \"Series Resistance\" in BJTs? Why is it
necessary for the base region in a BJT to be narrow\'? What is the precise definition of
\"narrow\"? The arrows in the figure shows different current density components in an npn BJT.
Identify the biasing mode Write the current density components in the boxes.
Solution
a)
The emitter efficiency, is defined as the ratio of the electron current in the emitter, to the sum of
the electron and hole current diffusing across the base-emitter junction.
The transport factor, equals the ratio of the current due to electrons injected in the collector, to
the current due to electrons injected in the base.
b)
Large area bipolar transistors can have a very non-uniform current distribution due to the
resistance of the base layer. Since the base current is applied through the thin base layer, there
can be a significant series resistance in large devices.
c)
Base of a BJT is usually made thin and doped less densily to keep the base current small and
allow the electrons to move much more freely between emiiter and collector.
The narroness is precisely defined in base transportation factor. Greater the transportation factor,
greater the narrowness.
d)
i) It is active mode biasing. Base emitter junction forward biased and base collector junction
reverse biased.
ii) In collector area, the top most box represents electron diffusion current density, resulting from
injected electrons successfully crossing the base.
The next box down represents the current density due to combination of minority carrier holes
from collector and electron from base at collector.
The next box down represents the current density resulting from injected electrons getting
trapped in the base.
In the base region, the top most box represents electron diffusion current density, resulting from
injected electrons successfully crossing the base.
The next box down represents base current due to hole electron recombination at base.
In the base emiter junction the box represent current density due to injected electrons from
emitter to base.
In the collector, the topmost box represents current density due to injected electrons from emitter
to base .
The next box down represents current density due to electron hole recombination at base emitter
junction.
The next box down is due to successful hole injection from base to emitter..
What dimensions of quality were highlighted in the Delta Airlines ba.pdffcaindore
What are the consequences of a spinal injury in the thoracic region of the spinal cord if the
damage is to the gray matter? What about a complete transection of the white matter in the
thoracic region? What body regions and functions that would be disrupted? Why is a white
matter injury in the upper cervical region worse than one lower down in the cord? How do white
matter injuries affect reflexes? How do gray matter injuries affect reflexes? F: Explain the
Solution
Grey matter is found in spinal cord which is known as the grey column. Grey matter Fuctions on
most of the brain\'s neuronal cell bodies. The grey matter works in muscle control, sensory
perception such as seeing and hearing, memory, emotions, speech, decision making, and self-
control. So we can say if Gray Matter damage then person can loose their hearing ability, speech
ability. Person will unable to control their Eomtions and can go Memory Loss, weakness,less
coordination, paralysis, tingling, loss of sensation, loss of bladder control.
Thoracic region structred follows which is in 12 parts. These all are indicate T1 through T12 (top
to bottom). T1 is the smallest and T12 is the largest thoracic vertebra. The thoracic region with
white matter control Chest, abdominal muscles.
If injury occur in Cervical (C1-C8) then Head neck,diaphragm and arm disrupted; if thoracic
region (T1-T12) injured then chest and abdominal mussle disrupted; if lumber region (L1-L5)
then hip and leg will be disrupted.
hite matter damage is called white matter (WMD) of the brain. White matter are the fibrous
tracts of the brain. Periventricular leukomalacia (PVL), which is addressed in this section of this
site, is a form of WMD adjacent to the ventricles of the brain, often due to fluctuations in blood
pressure or inflammation associated with prematurity. WMD can occur in other areas of the
brain for other reasons..
What are the similarities and differences between the ETC of Photosy.pdffcaindore
What are non-tax costs of tax planning?
Solution
Followings are the main non-tax costs of tax planning;
1. Organizational form costs;
Organizational form costs are also known as non-tax costs of tax planning.
2. Risk;
Risk of the investment is closely associated with taxation hene it is known as non-tax costs of tax
palnning.
3. Administrative costs;
Legal, accounting, and data processing fees are known as administartive costs of tax planning.
4. Agency (incentive) costs;
Agency (incentive) costs are also known as non-tax costs of tax palnning.
5. Financial reporting costs;
Financial reporting costs are also non-tax costs of tax palnning.
6. Transaction costs;
Transaction costs are also part of non-tax costs of tax palnning etc..
What are non-tax costs of tax planningSolutionFollowings are .pdffcaindore
We are going to revisit the quota system in the milk industry in France. Then given the following
information:
Pq= $2 is the price of one unit of quota.
Pc= $5 is the price which the consumers pays for each unit of milk when the quota is enforced.
Qq= 20 is the amount of quota set by the French government.
Answer whether each of the following are True/False and clearly explain your conclusion.
If a producer owned one unit of quota and the cost of producing one unit of milk was $2 then he
should NOTsell his quota.
If you owned 10 units of the quota and you planned to sell all of them, then you should expect to
receive $20 in revenue from the sale.
This quota system does not create a Deadweight Loss (DWL).
Solution
1.False.
if he sells the quota then there would be no profits but no loss either.So,he can sell the quota.
2.True
Price of 1 unit of quota=$2
Quantity=10
Total revenue=20
3.Quota creates DEAL because the quantity sold after quota is less than equilibrium quantity and
the price the consumer pays is more than equilibrium price .
Answer-False..
There is a host of sociological and cultural research that paints a r.pdffcaindore
the value of an uncirculated \'Mint State-65\' 1950 Jefferson nickel minted in Denver is 7/5 the
value a 1945 nickel minted in Philadelphia in similar condition. together the value of the two
coins is $96. what is the value of each coin?
what is the value of the 1945 nickel?
$
what is the value of the 1950 nickel?
$
Solution
Let the value of 1945 nickel minted in Philadelphia be =x
The value of the 1950 Jefferson nickle minted in Denver = y= 7x/5
We know that x+ y= 96
x+7x/5 =96 so 12x/5=96
Hence x=96*5/12 = 8*5=40 $
So x=40, y=7x/5= 7*40/5 = 7*8=56$
Thus the value of 1945 nickle mintred in Philadelphia = 40$ and
The value of 1950 Mint State-65 Jefferson nickled minted in Denver = 56$.
True or False With argument passage by reference, the address of the.pdffcaindore
Today’s desktop computers use a 7-wire cable that is about ½” wide to communicate between
the motherboard and storage devices. This interface is known as _____. (Obj. 3.2) Parallel ATA
(PATA) Fibre Channel (FC) Serial ATA (SATA) Small Computer System Interface (SCSI)
Solution
Today’s desktop computers use a 7-wire cable that is about ½” wide to communicate between
the motherboard and storage devices. This interface is known as SATA
SCSI interfaces provide for data transmission rates up to 80 mbps
Third-generation SATA interfaces run with a native transfer rate of 6.0 Gbit/s
PATA maximum speed of 133 Mbps of data transfer.
FC is used to connect computer data storage to server.
This is problem is same problem which i submitted on 22017, I just.pdffcaindore
There is a host of sociological and cultural research that paints a robust picture of the effects of
globalization on culture. This Application focuses on the flows of culture between Western and
developing nations. As a practitioner in this global environment, you should be familiar with
these culture effects. Use newspapers, magazines, and the Internet to research cultural changes in
both Western and developing countries due to globalization. Then perform the following tasks:
Outline the cultural aspects of globalization. Take an anthropological, rather than a business,
perspective. Explain how you think understanding culture helps in doing business in today\'s
global economy. Cite resources to justify your response.
Solution
Information technology has penetrated almost every aspect of our lives, “shrinking” our world
into a global village.
Economies and cultures have come closer. People are now aware of the cultures, traditions,
lifestyle, living conditions
prevailing in almost every corner of the world. Interestingly, this is going beyond awareness and
into a state of
integration that is a result of cross-pollinated views, ideologies, products and services.
This evolution is termed as “globalization.”
Culture has many definitions. My own definition is that culture is our collective experience as a
society,
and its impact on our reaction and decision-making relative to every-day facts and
circumstances.
Why is cross-cultural competence critical to your professional future and the viability of your
company?
It’s omnipresent in every business interaction and strategic decision.It is not feasible to be an
expert on
all the world’s cultures. It is possible, however, to incorporate a cross-cultural framework that
improves
cross-cultural understanding and interactions.
Multinational firms whose operations are borderless have to consider the cultural variability of
different regions
of the world and develop cultural understanding. Major cultural constraints encountered by
businesses include local
attitudes, taste preferences, language, religion, management style, gender discrimination, skills,
personalities,
education, etc. To be successful, they need to mold their business actions in accordance with the
local cultural models,
they need to establish a global mindset.
Let’s consider an example of the food giant, McDonald’s. The company enjoys a global
presence; operating in more than
100 countries serving 70 million people every day. Their headquarters and senior management
are U.S.-based but they
entrust their local operations to local managers of the countries they operate in. Operations in
more than 50 percent of
their outlets are franchised. Furthermore, their menus are customized according to cultural
habits and local taste
preferences in every country. It is without a doubt that global thinking and cultural
understanding are both powerful
business tools which allow multinational firms to dominate the local markets and establish a
global pres.
SOme of functions of the eukaryotic orgenelles are performed in bact.pdffcaindore
Solve the congruence b) 5x 6 mod 7 c) 5x 0 mod 7
Solution
We have 5x 6 mod 7 and 5x 0 mod 7.
As per the 1st congruence, 5x = 6+7p, where p is an integer and as per the 2nd congruence, 5x =
7q, where q is an integer. These two equations are apparently inconsistent as 6 is not a multiple
of 7. Therefore, the given congruences are inconsistent. There is no solution..
please explain the global entreprenurship revolution for a flatter w.pdffcaindore
please check my work for this question i am unsure if i did it correctly. 2. Locate the chiral
center in each structure below and identify as R or S: OH HO 41 OH 3. Provide the IUPAC
name for each of the following compounds (include the stereochemistry
Solution
The second one is correct but the first one is wrong.
The priority order is 1 -OH
2 -CH2OCOCH3
3 -CH2OH
4 -H so the rotation is anticlockwise(ACW)
Hence it is also S type..
ourse O D. growth rate of currency in circulation-growth rate of the .pdffcaindore
ourse O D. growth rate of currency in circulation-growth rate of the price level QUESTION 9
holds, the inflation rate in the economy will be: D. 1496 QUESTION 10
Solution
9.
A.2%
Inflation rate = Money supply growth rate – real GDP growth rate
Inflation rate = 8%-6% = 2%
10.
A.Deflation rate
It is used to calculate the decrease in CPI or other price index..
Modify the project so tat records are inserted into the random acess.pdffcaindore
Modify the project so tat records are inserted into the random acess file in ascending order using
an insertion sort methodology with the SSN acting as the key value. This requires defining the
method compareTo() in the Personal and Student classes to be used in a modified method add()
in Database. The method finds a proper position for a record d, moves all the records in the file
to make room for d, and writres d into the file. With the new organization of the data files, find()
and modify() can also be modified. For example, find() stops its sequential search when it
encounters a record greater than the record looked for (or reaches the end of the file).
Database.java
import java.io.*;
public class Database {
private RandomAccessFile database;
private String fName = new String();;
private IOmethods io = new IOmethods();
Database() throws IOException {
System.out.print(\"File name: \");
fName = io.readLine();
}
private void add(DbObject d) throws IOException {
database = new RandomAccessFile(fName,\"rw\");
database.seek(database.length());
d.writeToFile(database);
database.close();
}
private void modify(DbObject d) throws IOException {
DbObject[] tmp = new DbObject[1];
d.copy(tmp);
database = new RandomAccessFile(fName,\"rw\");
while (database.getFilePointer() < database.length()) {
tmp[0].readFromFile(database);
if (tmp[0].equals(d)) {
tmp[0].readFromConsole();
database.seek(database.getFilePointer()-d.size());
tmp[0].writeToFile(database);
database.close();
return;
}
}
database.close();
System.out.println(\"The record to be modified is not in the database\");
}
private boolean find(DbObject d) throws IOException {
DbObject[] tmp = new DbObject[1];
d.copy(tmp);
database = new RandomAccessFile(fName,\"r\");
while (database.getFilePointer() < database.length()) {
tmp[0].readFromFile(database);
if (tmp[0].equals(d)) {
database.close();
return true;
}
}
database.close();
return false;
}
private void printDb(DbObject d) throws IOException {
database = new RandomAccessFile(fName,\"r\");
while (database.getFilePointer() < database.length()) {
d.readFromFile(database);
d.writeLegibly();
System.out.println();
}
database.close();
}
public void run(DbObject rec) throws IOException {
String option;
System.out.println(\"1. Add 2. Find 3. Modify a record; 4. Exit\");
System.out.print(\"Enter an option: \");
option = io.readLine();
while (true) {
if (option.charAt(0) == \'1\') {
rec.readFromConsole();
add(rec);
}
else if (option.charAt(0) == \'2\') {
rec.readKey();
System.out.print(\"The record is \");
if (find(rec) == false)
System.out.print(\"not \");
System.out.println(\"in the database\");
}
else if (option.charAt(0) == \'3\') {
rec.readKey();
modify(rec);
}
else if (option.charAt(0) != \'4\')
System.out.println(\"Wrong option\");
else return;
printDb(rec);
System.out.print(\"Enter an option: \");
option = io.readLine();
}
}
}
import java.io.*;
public interface DbObject {
public void writeToFile(RandomAccessFile out) throws IOException;
public void r.
Many hospitals have systems in place and are now or will in the futu.pdffcaindore
Many hospitals have systems in place and are now or will in the future face the task of
determining which data in the previous system should be migrated or mapped to the new system.
Look at this topic from both the health information management and information systems
perspective. Select one or two systems, such as registration, admissions-discharges-transfers,
billing, chart tracking, or release of information, and identify which data elements would need to
be brought forward to a new system and why. Identify which data elements have long-term value
for patient care and which data elements must be preserved and accessible but may not be
actively used for patient care.
Solution
It is well aware that the success of the health care organization depends on the strong database
system of the organization. Now days, we can observe that hospitals are focussing on the up
gradation of their systems. It is important to retain the valuable information related to the patients
for the future and discard the irrelevant information related to the patient which would not be
used in future. It helps in retrieving the useful information easily any time in the future and
beneficial for the patient too in providing the right care to the patient. We can evaluate the two
systems which are admission of the patient and the discharge of the patient.
The admission related system includes lots of data elements like demographics, diagnosis,
pharmacy, procedure, laboratory tests, and clinical services, etc. It is clear that all the
information is important and may be needed in future, if the patient has and serious or chronic
diseases. It is important to brought forward all the elements of the admission system to the new
system for the future reference. If in case, the patient does not have any chronic diseases or just
came for the routine test, or the information related to the test which are not useful for future
may be discarded or do not need to upgrade in a new system.
Like admission system, discharge system is also very important because it gives all the
information about the medical history and payment related information of the patient. It includes
all the information related to a patient in the form of bill no, payment modes, demographic
information, federal tax number, clinical services provided, patient’s security number, patient’s
race and ethnicity, etc. In case of discharge system, It is important to retain the information
related to demographic and payment details for the future reference. Race and ethnicity related
information are irrelvant to upgrade in a new system..
List the S + D and the organism that causes a vesicle, Gumma, purule.pdffcaindore
List the S + D and the organism that causes a: vesicle, Gumma, purulent exudate, pharyngitis
and wart
Solution
Genital herpes - caused by herpes simplex virus 2; This is a highly contagious because , since the
signs and symptoms are mild and often go unnoticed. These show the formation of vesicles.
Genital warts symptoms - this is one of th most common type of STIs, which put women at a
high risk of cervical cancer. This infection show symptoms of warts . Human papilloma virus.
Cervicitis- A major symptom of this disease is a purulent endocervical exudate, that is visible in
the ends cervical canal. Caused by Trichomonas vaginalis and herpes simplex virus.
Gonococcal pharyngitis - Causative organism - Neisseria gonorrhoea , results in pharyngitis ,
spreading through oral sex..
Let k be the number of ON-state devices in a group of n devices on a .pdffcaindore
Let k be the number of ON-state devices in a group of n devices on a circuit board. Assume all n
devices are independent (functionally). Write a program (in MatLab or in C/C++ to compute
P(k) = (n k) (p^k) (l - p)^n - k, if P denotes the probability of a device being ON state.
Solution
defects=0:200; y = binopdf(defects,200,.02); [x,i]=max(y); defects(i).
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
How libraries can support authors with open access requirements for UKRI fund...
Here is my code. There are Two C Programs which need to follow the a.pdf
1. Here is my code. There are Two C Programs which need to follow the above format
TexttoBinary.C
#include
#include
int main() {
FILE *fpIn, *fpOut;
fpIn = fopen("TextToBinaryInput.txt", "r");
fpOut = fopen("TextToBinaryOutput.txt", "wb");
char firstName[255], lastName[255];
unsigned int id;
float gpa;
unsigned char firstLength, lastLength;
while(!feof(fpIn)){
fscanf(fpIn, "%s%s%u%f", firstName, lastName, &id, &gpa);
//printf("%s %s %u %f ", firstName, lastName, id, gpa);
firstLength = strlen(firstName);
lastLength = strlen(lastName);
fwrite(&firstLength, 1, 1, fpOut);
fwrite(firstName, 1, firstLength, fpOut);
fwrite(&lastLength, 1, 1, fpOut);
fwrite(lastName, 1, lastLength, fpOut);
fwrite(&id, 4, 1, fpOut);
fwrite(&gpa, 4, 1, fpOut);
}
fclose(fpIn);
fclose(fpOut);
}
BinarytoText.C
#include
#include
#include
//stdtent data type to store info
struct student
{
char firstname[255],lastname[255];
2. unsigned int id;
float gpa;
};
//function prototypes
int longestName(struct student data[],int n);
int shortestName(struct student data[],int n);
int highestId(struct student data[],int n);
int lowestId(struct student data[],int n);
int highestGPA(struct student data[],int n);
int lowestGPA(struct student data[],int n);
////////////////////
int main()
{
struct student data[20]; // array of student
int n,i;
float tgpa;
FILE *fp,*fout;
int longestname,shortestname;
int highestid,lowestid;
int highestgpa,lowestgpa;
fp=fopen("bina.dat","rb"); // open the binary file
if(fp==NULL)
{
printf("Unable to open file");
exit(0);
}
fout=fopen("tex.txt","w"); //open the text file
n=0;
//scan the binary file continiously and store the data in text file as well as in array of student
structure
while(fscanf(fp,"%s%s%d%f",data[n].firstname,data[n].lastname,&data[n].id,&tgpa)!=EOF)
{
data[n].gpa=tgpa;
3. fprintf(fout,"%st%st%dt%0.2f ",data[n].firstname,data[n].lastname,data[n].id,tgpa);
n++;
}
// print the data
for(i=0;imaxlen)
{
maxlen=strlen(data[i].firstname)+strlen(data[i].firstname);
index=i;
}
}
return index;
}
// returns the index of student having shortest name
int shortestName(struct student data[],int n)
{
int i,minlen,index=0;
minlen=strlen(data[0].firstname)+strlen(data[0].lastname);
for(i=1;imax)
{
max=data[i].gpa;
index=i;
}
}
return index;
}
// returns the index of student having lowest id
int lowestId(struct student data[],int n)
{
int i,min,index=0;
min=data[0].id;
for(i=1;imax)
{
max=data[i].id;
index=i;
}
4. }
return index;
}
// returns the index of student having lowest gpa
int lowestGPA(struct student data[],int n)
{
int i,min,index=0;
min=data[0].gpa;
for(i=1;i
Solution
Steps to Compile using gcc compiler on linux platform:
#1. gcc main.c binarytotext.c texttobinary.c [this will make a.out executable]
#2. ./a.out [we can run a.out in this way]
Note: Calling sequence of binaryToText_main() and textToBinary_main() depends on your
functionality.
----------------------
File#1 [main.c]
----------------------
#include "header.h"
int main()
{
binaryToText_main();
textToBinary_main();
return 0;
}
--------------------------------
File#2 [texttobinary.c]
--------------------------------
#include "header.h"
int textToBinary_main()
{
FILE *fpIn, *fpOut;
fpIn = fopen("TextToBinaryInput.txt", "r");
fpOut = fopen("TextToBinaryOutput.txt", "wb");
5. char firstName[255], lastName[255];
unsigned int id;
float gpa;
unsigned char firstLength, lastLength;
while(!feof(fpIn))
{
fscanf(fpIn, "%s%s%u%f", firstName, lastName, &id, &gpa);
//printf("%s %s %u %f ", firstName, lastName, id, gpa);
firstLength = strlen(firstName);
lastLength = strlen(lastName);
fwrite(&firstLength, 1, 1, fpOut);
fwrite(firstName, 1, firstLength, fpOut);
fwrite(&lastLength, 1, 1, fpOut);
fwrite(lastName, 1, lastLength, fpOut);
fwrite(&id, 4, 1, fpOut);
fwrite(&gpa, 4, 1, fpOut);
}
fclose(fpIn);
fclose(fpOut);
}
---------------------------------
File#3 [binarytotext.c]
---------------------------------
#include "header.h"
//function prototypes
int longestName(struct student data[],int n);
int shortestName(struct student data[],int n);
int highestId(struct student data[],int n);
int lowestId(struct student data[],int n);
int highestGPA(struct student data[],int n);
int lowestGPA(struct student data[],int n);
// returns the index of student having longest name
int binaryToText_main()
{
struct student data[20]; // array of student
6. int n,i;
float tgpa;
FILE *fp,*fout;
int longestname,shortestname;
int highestid,lowestid;
int highestgpa,lowestgpa;
fp=fopen("bina.dat","rb"); // open the binary file
if(fp==NULL)
{
printf("Unable to open file");
exit(0);
}
fout=fopen("tex.txt","w"); //open the text file
n=0;
//scan the binary file continiously and store the data in text file as well as in array of student
structure
while(fscanf(fp,"%s%s%d%f",data[n].firstname,data[n].lastname,&data[n].id,&tgpa)!=EOF)
{
data[n].gpa=tgpa;
fprintf(fout,"%st%st%dt%0.2f ",data[n].firstname,data[n].lastname,data[n].id,tgpa);
n++;
}
// print the data
for(i=0;imaxlen)
{
maxlen=strlen(data[i].firstname)+strlen(data[i].firstname);
index=i;
}
}
return index;
}
// returns the index of student having shortest name
7. int shortestName(struct student data[],int n)
{
int i,minlen,index=0;
minlen=strlen(data[0].firstname)+strlen(data[0].lastname);
for(i=1;imax)
{
max=data[i].gpa;
index=i;
}
}
return index;
}
// returns the index of student having lowest id
int lowestId(struct student data[],int n)
{
int i,min,index=0;
min=data[0].id;
for(i=1;imax)
{
max=data[i].id;
index=i;
}
}
return index;
}
// returns the index of student having lowest gpa
int lowestGPA(struct student data[],int n)
{
int i,min,index=0;
min=data[0].gpa;
for(i=1;i
#include
#include
8. struct student
{
char firstname[255],lastname[255];
unsigned int id;
float gpa;
};
int longestName(struct student data[],int n);
int shortestName(struct student data[],int n);
int highestId(struct student data[],int n);
int lowestId(struct student data[],int n);
int highestGPA(struct student data[],int n);
int lowestGPA(struct student data[],int n);