SlideShare a Scribd company logo
1 of 2
Download to read offline
Hello, I need help writing a code in C. It wants to do things with files. It gives us two files. The
code must first ask which file they want, then open the file. Once opened, the file will have three
colums: the names alphabetically, the rank of the name (a name with a rank of 232 is the 232nd
most popular name in 2014), and the total number of recorded instances. The program then
prompts the user to input a name, when inputed, If the name is found in the database, display the
name rank, and number of the name in sequence with the prior two names and the following two
names. If the name is not shown, show only the two entries before and after the position where
the name would be. My major is mechanical so i have never been very good at coding. Any help
would be greatly appreciated. Thank you for your time.
Solution
#include
int main()
{
int c;
char str[30];
printf("Enter your choice  1.First file 2.Second file ");
scanf("%d",&c);
switch(c)
{
case 1: FILE *fptr=fopen("First file",rb);
break;
case 2:FILE *fptr=fopen("Second file",rb);
break;
default: printf("Enter the correct option ");
return 1;
}
struct emp
{
char name[20];
int pos;
int num;
}e1;
printf("Enter the name for search the name in that file: ");
scanf("%s",str);
while(1)
{
fread(fptr,1,&e1);
if(strcmp(e1->name,str)==1)
{
printf("%st%dt%d ",e1->name,e1->pos,e1->num);
break;
}
}
fclose(fptr);
return 0;
}

More Related Content

Similar to Hello, I need help writing a code in C. It wants to do things with f.pdf

This project is the first projects you will be working on this quart.pdf
This project is the first projects you will be working on this quart.pdfThis project is the first projects you will be working on this quart.pdf
This project is the first projects you will be working on this quart.pdfeyewaregallery
 
ch06-file-processing.ppt
ch06-file-processing.pptch06-file-processing.ppt
ch06-file-processing.pptMahyuddin8
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell ScriptingJaibeer Malik
 
Extracting Archival-Quality Information from Software-Related Chats
Extracting Archival-Quality Information from Software-Related ChatsExtracting Archival-Quality Information from Software-Related Chats
Extracting Archival-Quality Information from Software-Related ChatsPreetha Chatterjee
 
Mi 103 mi 103 quiz 2 (1)
Mi 103 mi 103 quiz 2 (1)Mi 103 mi 103 quiz 2 (1)
Mi 103 mi 103 quiz 2 (1)Amit Vats
 
Mi 103 mi 103 quiz 2
Mi 103 mi 103 quiz 2Mi 103 mi 103 quiz 2
Mi 103 mi 103 quiz 2Amit Vats
 
Assignment- C++ Write a program that reads a text file using binary mo.docx
Assignment- C++ Write a program that reads a text file using binary mo.docxAssignment- C++ Write a program that reads a text file using binary mo.docx
Assignment- C++ Write a program that reads a text file using binary mo.docxbickerstaffinell
 
02 fundamentals
02 fundamentals02 fundamentals
02 fundamentalssirmanohar
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course BasicNaiyan Noor
 
File management in C++
File management in C++File management in C++
File management in C++apoorvaverma33
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1tutorialsruby
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1tutorialsruby
 
A c program of Phonebook application
A c program of Phonebook applicationA c program of Phonebook application
A c program of Phonebook applicationsvrohith 9
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with exampleSunil Patel
 
Pacman game computer investigatory project
Pacman game computer investigatory projectPacman game computer investigatory project
Pacman game computer investigatory projectmeenaloshiniG
 

Similar to Hello, I need help writing a code in C. It wants to do things with f.pdf (20)

IOStream.pptx
IOStream.pptxIOStream.pptx
IOStream.pptx
 
ExtraFileIO.pptx
ExtraFileIO.pptxExtraFileIO.pptx
ExtraFileIO.pptx
 
This project is the first projects you will be working on this quart.pdf
This project is the first projects you will be working on this quart.pdfThis project is the first projects you will be working on this quart.pdf
This project is the first projects you will be working on this quart.pdf
 
ch06-file-processing.ppt
ch06-file-processing.pptch06-file-processing.ppt
ch06-file-processing.ppt
 
Unix And Shell Scripting
Unix And Shell ScriptingUnix And Shell Scripting
Unix And Shell Scripting
 
Extracting Archival-Quality Information from Software-Related Chats
Extracting Archival-Quality Information from Software-Related ChatsExtracting Archival-Quality Information from Software-Related Chats
Extracting Archival-Quality Information from Software-Related Chats
 
Mi 103 mi 103 quiz 2 (1)
Mi 103 mi 103 quiz 2 (1)Mi 103 mi 103 quiz 2 (1)
Mi 103 mi 103 quiz 2 (1)
 
Mi 103 mi 103 quiz 2
Mi 103 mi 103 quiz 2Mi 103 mi 103 quiz 2
Mi 103 mi 103 quiz 2
 
Unix
UnixUnix
Unix
 
Assignment- C++ Write a program that reads a text file using binary mo.docx
Assignment- C++ Write a program that reads a text file using binary mo.docxAssignment- C++ Write a program that reads a text file using binary mo.docx
Assignment- C++ Write a program that reads a text file using binary mo.docx
 
Linux basics
Linux basicsLinux basics
Linux basics
 
02 fundamentals
02 fundamentals02 fundamentals
02 fundamentals
 
Python Course Basic
Python Course BasicPython Course Basic
Python Course Basic
 
File management in C++
File management in C++File management in C++
File management in C++
 
File management
File managementFile management
File management
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1
 
cs3157-summer06-lab1
cs3157-summer06-lab1cs3157-summer06-lab1
cs3157-summer06-lab1
 
A c program of Phonebook application
A c program of Phonebook applicationA c program of Phonebook application
A c program of Phonebook application
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with example
 
Pacman game computer investigatory project
Pacman game computer investigatory projectPacman game computer investigatory project
Pacman game computer investigatory project
 

More from mohamednihalshahru

Which of the following characteristics of living organisms absolutel.pdf
Which of the following characteristics of living organisms absolutel.pdfWhich of the following characteristics of living organisms absolutel.pdf
Which of the following characteristics of living organisms absolutel.pdfmohamednihalshahru
 
What influence does the presence of alloying elements (other than ca.pdf
What influence does the presence of alloying elements (other than ca.pdfWhat influence does the presence of alloying elements (other than ca.pdf
What influence does the presence of alloying elements (other than ca.pdfmohamednihalshahru
 
Two very long uniformly charged lines (with linear charge densities i.pdf
Two very long uniformly charged lines (with linear charge densities i.pdfTwo very long uniformly charged lines (with linear charge densities i.pdf
Two very long uniformly charged lines (with linear charge densities i.pdfmohamednihalshahru
 
there is a serious outbreak of staph aureus in the hospital. A conve.pdf
there is a serious outbreak of staph aureus in the hospital. A conve.pdfthere is a serious outbreak of staph aureus in the hospital. A conve.pdf
there is a serious outbreak of staph aureus in the hospital. A conve.pdfmohamednihalshahru
 
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdf
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdfTimer Notes obiect and the dashed arrow the image. The rectangle show.pdf
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdfmohamednihalshahru
 
Representatives from four different colleges of UM- Dearborn will be .pdf
Representatives from four different colleges of UM- Dearborn will be .pdfRepresentatives from four different colleges of UM- Dearborn will be .pdf
Representatives from four different colleges of UM- Dearborn will be .pdfmohamednihalshahru
 
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdf
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdfProblem asks me to prove Uniqueness but Im not sure how to do it! .pdf
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdfmohamednihalshahru
 
please send edited codeMain.javapackage part2;import java.util.pdf
please send edited codeMain.javapackage part2;import java.util.pdfplease send edited codeMain.javapackage part2;import java.util.pdf
please send edited codeMain.javapackage part2;import java.util.pdfmohamednihalshahru
 
Inhaling and exhaling Label the figure that shows INHALATION and.pdf
Inhaling and exhaling  Label the figure that shows INHALATION and.pdfInhaling and exhaling  Label the figure that shows INHALATION and.pdf
Inhaling and exhaling Label the figure that shows INHALATION and.pdfmohamednihalshahru
 
In accordance to the PLSS land description system, locate the section.pdf
In accordance to the PLSS land description system, locate the section.pdfIn accordance to the PLSS land description system, locate the section.pdf
In accordance to the PLSS land description system, locate the section.pdfmohamednihalshahru
 
How can a topologically associating domain (TAD) mutation effect mor.pdf
How can a topologically associating domain (TAD) mutation effect mor.pdfHow can a topologically associating domain (TAD) mutation effect mor.pdf
How can a topologically associating domain (TAD) mutation effect mor.pdfmohamednihalshahru
 
Fix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdfFix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdfmohamednihalshahru
 
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdfmohamednihalshahru
 
Examine your opinion on the death penalty. Defend why you are for th.pdf
Examine your opinion on the death penalty. Defend why you are for th.pdfExamine your opinion on the death penalty. Defend why you are for th.pdf
Examine your opinion on the death penalty. Defend why you are for th.pdfmohamednihalshahru
 
Do you think that knowing about aggression between groups of chimpan.pdf
Do you think that knowing about aggression between groups of chimpan.pdfDo you think that knowing about aggression between groups of chimpan.pdf
Do you think that knowing about aggression between groups of chimpan.pdfmohamednihalshahru
 
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdf
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdfDiana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdf
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdfmohamednihalshahru
 
Create a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfCreate a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfmohamednihalshahru
 
Complete the following short answer questions1.  How do the virus.pdf
Complete the following short answer questions1.  How do the virus.pdfComplete the following short answer questions1.  How do the virus.pdf
Complete the following short answer questions1.  How do the virus.pdfmohamednihalshahru
 
Briefly describe the two competing theories regarding the origin of H.pdf
Briefly describe the two competing theories regarding the origin of H.pdfBriefly describe the two competing theories regarding the origin of H.pdf
Briefly describe the two competing theories regarding the origin of H.pdfmohamednihalshahru
 
Atlas Advertising Atlas Advertising is a regional advertising agency.pdf
Atlas Advertising Atlas Advertising is a regional advertising agency.pdfAtlas Advertising Atlas Advertising is a regional advertising agency.pdf
Atlas Advertising Atlas Advertising is a regional advertising agency.pdfmohamednihalshahru
 

More from mohamednihalshahru (20)

Which of the following characteristics of living organisms absolutel.pdf
Which of the following characteristics of living organisms absolutel.pdfWhich of the following characteristics of living organisms absolutel.pdf
Which of the following characteristics of living organisms absolutel.pdf
 
What influence does the presence of alloying elements (other than ca.pdf
What influence does the presence of alloying elements (other than ca.pdfWhat influence does the presence of alloying elements (other than ca.pdf
What influence does the presence of alloying elements (other than ca.pdf
 
Two very long uniformly charged lines (with linear charge densities i.pdf
Two very long uniformly charged lines (with linear charge densities i.pdfTwo very long uniformly charged lines (with linear charge densities i.pdf
Two very long uniformly charged lines (with linear charge densities i.pdf
 
there is a serious outbreak of staph aureus in the hospital. A conve.pdf
there is a serious outbreak of staph aureus in the hospital. A conve.pdfthere is a serious outbreak of staph aureus in the hospital. A conve.pdf
there is a serious outbreak of staph aureus in the hospital. A conve.pdf
 
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdf
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdfTimer Notes obiect and the dashed arrow the image. The rectangle show.pdf
Timer Notes obiect and the dashed arrow the image. The rectangle show.pdf
 
Representatives from four different colleges of UM- Dearborn will be .pdf
Representatives from four different colleges of UM- Dearborn will be .pdfRepresentatives from four different colleges of UM- Dearborn will be .pdf
Representatives from four different colleges of UM- Dearborn will be .pdf
 
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdf
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdfProblem asks me to prove Uniqueness but Im not sure how to do it! .pdf
Problem asks me to prove Uniqueness but Im not sure how to do it! .pdf
 
please send edited codeMain.javapackage part2;import java.util.pdf
please send edited codeMain.javapackage part2;import java.util.pdfplease send edited codeMain.javapackage part2;import java.util.pdf
please send edited codeMain.javapackage part2;import java.util.pdf
 
Inhaling and exhaling Label the figure that shows INHALATION and.pdf
Inhaling and exhaling  Label the figure that shows INHALATION and.pdfInhaling and exhaling  Label the figure that shows INHALATION and.pdf
Inhaling and exhaling Label the figure that shows INHALATION and.pdf
 
In accordance to the PLSS land description system, locate the section.pdf
In accordance to the PLSS land description system, locate the section.pdfIn accordance to the PLSS land description system, locate the section.pdf
In accordance to the PLSS land description system, locate the section.pdf
 
How can a topologically associating domain (TAD) mutation effect mor.pdf
How can a topologically associating domain (TAD) mutation effect mor.pdfHow can a topologically associating domain (TAD) mutation effect mor.pdf
How can a topologically associating domain (TAD) mutation effect mor.pdf
 
Fix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdfFix the following C program in linux. When it is compiled it gives t.pdf
Fix the following C program in linux. When it is compiled it gives t.pdf
 
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf
7. Wet ear wax (W) is dominant over dry ear wax (w)W=wet ear wax.pdf
 
Examine your opinion on the death penalty. Defend why you are for th.pdf
Examine your opinion on the death penalty. Defend why you are for th.pdfExamine your opinion on the death penalty. Defend why you are for th.pdf
Examine your opinion on the death penalty. Defend why you are for th.pdf
 
Do you think that knowing about aggression between groups of chimpan.pdf
Do you think that knowing about aggression between groups of chimpan.pdfDo you think that knowing about aggression between groups of chimpan.pdf
Do you think that knowing about aggression between groups of chimpan.pdf
 
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdf
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdfDiana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdf
Diana’s Death UnraveledHemophilia causes a lack of blood clotting,.pdf
 
Create a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdfCreate a new java class called ListNode. Implement ListNode as a gen.pdf
Create a new java class called ListNode. Implement ListNode as a gen.pdf
 
Complete the following short answer questions1.  How do the virus.pdf
Complete the following short answer questions1.  How do the virus.pdfComplete the following short answer questions1.  How do the virus.pdf
Complete the following short answer questions1.  How do the virus.pdf
 
Briefly describe the two competing theories regarding the origin of H.pdf
Briefly describe the two competing theories regarding the origin of H.pdfBriefly describe the two competing theories regarding the origin of H.pdf
Briefly describe the two competing theories regarding the origin of H.pdf
 
Atlas Advertising Atlas Advertising is a regional advertising agency.pdf
Atlas Advertising Atlas Advertising is a regional advertising agency.pdfAtlas Advertising Atlas Advertising is a regional advertising agency.pdf
Atlas Advertising Atlas Advertising is a regional advertising agency.pdf
 

Recently uploaded

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

Hello, I need help writing a code in C. It wants to do things with f.pdf

  • 1. Hello, I need help writing a code in C. It wants to do things with files. It gives us two files. The code must first ask which file they want, then open the file. Once opened, the file will have three colums: the names alphabetically, the rank of the name (a name with a rank of 232 is the 232nd most popular name in 2014), and the total number of recorded instances. The program then prompts the user to input a name, when inputed, If the name is found in the database, display the name rank, and number of the name in sequence with the prior two names and the following two names. If the name is not shown, show only the two entries before and after the position where the name would be. My major is mechanical so i have never been very good at coding. Any help would be greatly appreciated. Thank you for your time. Solution #include int main() { int c; char str[30]; printf("Enter your choice 1.First file 2.Second file "); scanf("%d",&c); switch(c) { case 1: FILE *fptr=fopen("First file",rb); break; case 2:FILE *fptr=fopen("Second file",rb); break; default: printf("Enter the correct option "); return 1; } struct emp { char name[20]; int pos; int num; }e1; printf("Enter the name for search the name in that file: ");