SlideShare a Scribd company logo
1 of 2
Download to read offline
Fix the following C program in linux. When it is compiled it gives the following error: warning
cast to pointer from integer of different size.
Solution
#ifndef endLocation
#define endLocation
#include "myLinkedlist.h"
#include "myString.h"
class endLocation
can use atoi
int travelCost; // can use atoi
public:
endLocation();
endLocation(String, int, int);
endLocation(endLocation& rhs);
void setName(String);
void setTime(int);
void setCost(int);
String getName();
int getTime();
int getCost();
};
#endif // endLocation
//.cpp implementation
endLocation::endLocation()
endLocation::endLocation(endLocation& rhs)
void endLocation::setName(String inputName)
void endLocation::setTime(int inputTime)
void endLocation::setCost(int inputCost)
String endLocation::getName()
come locationName;
}
int endLocation::getTime()
come travelTime;
}
int endLocation::getCost()
come travelCost;
}
Here is my main
int main( int argc, char* const argv[] )
range of lines here
for(int i = 0; i < num_lines; ++i)dissect and store all strings
size = findIndex(line, '|');
strncpy(name, line, size);
index = size + 1;
size = findIndex(line + index, '|');
strncpy(time, line + index, size);
index += size + 1;
size = findIndex(line + index, '|');
strncpy(cost, line + index, size);
}
in.close();
}
else

More Related Content

Similar to Fix the following C program in linux. When it is compiled it gives t.pdf

Functions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrupFunctions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrup
SyedHaroonShah4
 
Write a C++ program 1. Study the function process_text() in file.pdf
Write a C++ program 1. Study the function process_text() in file.pdfWrite a C++ program 1. Study the function process_text() in file.pdf
Write a C++ program 1. Study the function process_text() in file.pdf
jillisacebi75827
 
C++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdfC++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdf
arrowcomputers8700
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
Jussi Pohjolainen
 
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
C++ BinaryTree Help  Creating main function for Trees...Here are .pdfC++ BinaryTree Help  Creating main function for Trees...Here are .pdf
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
forecastfashions
 
Using C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdfUsing C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdf
smitaguptabootique
 

Similar to Fix the following C program in linux. When it is compiled it gives t.pdf (20)

Functions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrupFunctions And Header Files In C++ | Bjarne stroustrup
Functions And Header Files In C++ | Bjarne stroustrup
 
Write a C++ program 1. Study the function process_text() in file.pdf
Write a C++ program 1. Study the function process_text() in file.pdfWrite a C++ program 1. Study the function process_text() in file.pdf
Write a C++ program 1. Study the function process_text() in file.pdf
 
C++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdfC++ Programming Language N-number queue rotations.Write methods v.pdf
C++ Programming Language N-number queue rotations.Write methods v.pdf
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
C tutorial
C tutorialC tutorial
C tutorial
 
Csdfsadf
CsdfsadfCsdfsadf
Csdfsadf
 
C
CC
C
 
C
CC
C
 
Reduce course notes class xii
Reduce course notes class xiiReduce course notes class xii
Reduce course notes class xii
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
C Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.comC Programming Tutorial - www.infomtec.com
C Programming Tutorial - www.infomtec.com
 
Go Programming Language (Golang)
Go Programming Language (Golang)Go Programming Language (Golang)
Go Programming Language (Golang)
 
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
C++ BinaryTree Help  Creating main function for Trees...Here are .pdfC++ BinaryTree Help  Creating main function for Trees...Here are .pdf
C++ BinaryTree Help Creating main function for Trees...Here are .pdf
 
Introduction to go
Introduction to goIntroduction to go
Introduction to go
 
Using C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdfUsing C language to write an algorithm that accepts a list implement.pdf
Using C language to write an algorithm that accepts a list implement.pdf
 

More from mohamednihalshahru

Hello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdfHello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdf
mohamednihalshahru
 
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
mohamednihalshahru
 
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
mohamednihalshahru
 
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
mohamednihalshahru
 
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
mohamednihalshahru
 
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
mohamednihalshahru
 

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
 
Hello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.pdfHello, I need help writing a code in C. It wants to do things with f.pdf
Hello, I need help writing a code in C. It wants to do things with f.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

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
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
AnaAcapella
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
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
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 

Fix the following C program in linux. When it is compiled it gives t.pdf

  • 1. Fix the following C program in linux. When it is compiled it gives the following error: warning cast to pointer from integer of different size. Solution #ifndef endLocation #define endLocation #include "myLinkedlist.h" #include "myString.h" class endLocation can use atoi int travelCost; // can use atoi public: endLocation(); endLocation(String, int, int); endLocation(endLocation& rhs); void setName(String); void setTime(int); void setCost(int); String getName(); int getTime(); int getCost(); }; #endif // endLocation //.cpp implementation endLocation::endLocation() endLocation::endLocation(endLocation& rhs) void endLocation::setName(String inputName) void endLocation::setTime(int inputTime) void endLocation::setCost(int inputCost) String endLocation::getName() come locationName; } int endLocation::getTime() come travelTime;
  • 2. } int endLocation::getCost() come travelCost; } Here is my main int main( int argc, char* const argv[] ) range of lines here for(int i = 0; i < num_lines; ++i)dissect and store all strings size = findIndex(line, '|'); strncpy(name, line, size); index = size + 1; size = findIndex(line + index, '|'); strncpy(time, line + index, size); index += size + 1; size = findIndex(line + index, '|'); strncpy(cost, line + index, size); } in.close(); } else