ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

can someone edit my c++ code where it will output to a file in xcode #include iostream #include fstream // For file operations #include string.

by | Nov 28, 2023 | engineering

can someone edit my c++ code where it will output to a file in xcode

#include <iostream>#include <fstream> //For file operations#include <string.h> //For string comparisionsusing namespace std;struct StockNode{ //Creating of linked list node structure   char itemname[20];   char itemnumber[5];   char quantity[3];   char price[6];   char safestock[3];   struct StockNode *link;};

class InventoryStock //Class for operations and members{   StockNode *head;   public:       InventoryStock() //Constructor default       {           head=NULL;       }       void addStockNode(StockNode *nn) //Add node method       {           StockNode *temp=NULL;           if(head==NULL || strcmp(head->itemname,nn->itemname)>=0)   // Adding first node whether null or head node smaller than nn           {               nn->link=head;               head=nn;               return;           }       temp=head;       while(temp->link!=NULL && strcmp(temp->itemname,nn->itemname)<0) //Traverse upto null before or find a node which is > than new node nn       temp=temp->link;       nn->link=temp->link; //If found insert in its sorted location       temp->link=nn;       }                                   void traverse() //To display sorted list       {           StockNode *temp=head;           cout<<“nNames of Items : “<<endl;           while(temp!=NULL)               cout<<temp->itemname<<“->”;       }   };     int main()   {     InventoryStock i1;   StockNode readstock;   ifstream ifile;   ifile.open(“Invent.txt”); //Open file for reading     while(!ifile.eof()) //Read until eof   {      ifile>>readstock.itemname>>readstock.itemnumber>>readstock.quantity>>readstock.price>>readstock.safestock; //Read each record of file        i1.addStockNode(&readstock); //Add to sorted linked list   }   ifile.close(); //Close the file   i1.traverse(); // Traverse list   return 0;}

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!