Question

Using C programming (Microsoft Visual Studio)

This is the code I have

#include "pch.h"

#include <iostream>

#include <string.h>

#include <stdlib.h>

#include <stdio.h>

#include<dos.h>

#include <iostream>

int id_arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };

int pid_arr[] = { 0, 0, 0, 1, 13, 1, 2, 2, 5, 5, 5, 10, 4 };

char title_arr[][100] = {

"Books & Audibles",

"Electronics",

"Food",

"Books",

"Science & Mathematics books",

"Fictions",

"Phones",

"Appliances",

"Astronomy",

"Physics",

"Biology",

"Nuclear Physics",

"Textbook Rent. Buy. Sell"

};

void getSub(int id);

int get_id_index(int id);

int main() {

for (int i = 0; i < 13; i++) {

int pid = pid_arr[i];

if (pid == 0) {

int id = id_arr[i];

printf("%s ", title_arr[i]);

getSub(id);

}

}

return 0;

}

void getSub(int id) {

for (int i = 0; i < 13; i++) {

if (pid_arr[i] == id) {

printf("--- %s ", title_arr[i]);

//int index = get_id_index(id);

int id = id_arr[i];

getSub(id);

}

}

}

int get_id_index(int id) {

for (int i = 0; i < 13; i++) {

if (id_arr[i] == id)

return i;

}

}

Program : Tree-list Write a program that generate tree-list of all categories For example Tree-list for above data is Books & Audibles Books - Textbook Rent. Buy. Sell -- ..- Science & Mathematics books -Physics Nuclear Physics Biology -- Fictions Electronics ーPhones Appliances Food

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Using C programming (Microsoft Visual Studio) This is the code I have #include "pch.h" #include <iostream>...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • in c++ please program for this code #include <iostream> #include <fstream> #include <string> #include <cstring> //...

    in c++ please program for this code #include <iostream> #include <fstream> #include <string> #include <cstring> // for string tokenizer and c-style string processing #include <algorithm> // max function #include <stdlib.h> #include <time.h> using namespace std; // Extend the code here as needed class BTNode{ private: int nodeid; int data; int levelNum; BTNode* leftChildPtr; BTNode* rightChildPtr; public: BTNode(){} void setNodeId(int id){ nodeid = id; } int getNodeId(){ return nodeid; } void setData(int d){ data = d; } int getData(){ return data;...

  • THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #inclu...

    THIS IS FOR C++ PROGRAMMING USING VISUAL STUDIO THE PROGRAM NEEDS TO BE IN C++ PROGRAMMING #include "pch.h" #include #include using namespace std; // Function prototype void displayMessage(void); void totalFees(void); double calculateFees(int); double calculateFees(int bags) {    return bags * 30.0; } void displayMessage(void) {    cout << "This program calculates the total amount of checked bag fees." << endl; } void totalFees() {    double bags = 0;    cout << "Enter the amount of checked bags you have." << endl;    cout <<...

  • what is the output for the following code? explain the steps. /*#include <iostream> using namespace std;...

    what is the output for the following code? explain the steps. /*#include <iostream> using namespace std; int f(int &i) { i = 10; return(5 * i); } int main() { int n = 5; f(n); cout << n << "\n"; return 0; } #include <iostream> using namespace std; int sub1(int n) { n--; return n; } int main() { int m = 10; for(int j = 0; j < 10; j++) m -= sub1(j); cout << m << "\n"; return...

  • Can you help with this C programming question. I have provided the skeleton code below along...

    Can you help with this C programming question. I have provided the skeleton code below along with the Stack/Data/Process Class for you to see/reference. Along with the Stack/Data type definition.   **SKELTON CODE** #include #include #include Stack* concat_stack(Stack *s1, Stack *s2) { //your code here return NULL; } **STACK CLASS FOR YOU TO REFERENCE** #include #include #include #include Stack* create_stack(int stack_capacity) { Stack *s = (Stack*) malloc(sizeof(Stack)); if (stack_capacity < 1) { fprintf(stderr, "Error(create_stack): invalid capacity, set to 10\n"); s->capacity =...

  • C++ Help. I am new to Visual Studio and C++ so please include comments! Please follow...

    C++ Help. I am new to Visual Studio and C++ so please include comments! Please follow the directions and make as simple as possible. Write a C++ program that reads the following list of input data (book.dat) and then allows users to search and view the books from a Menu List all available books Search for book using A. Title or B. ISBN? Exit Program The format of the file is as follows: //    The title of the book //   ...

  • Rewrite this code in Java please #include <iostream> #include <fstream> #include <cstdlib> #include <ctime> using namespace...

    Rewrite this code in Java please #include <iostream> #include <fstream> #include <cstdlib> #include <ctime> using namespace std; long length = 1000; const long max_length = 100000; int list[max_length]; void read() {     ifstream fin("random.dat", ios::binary);     for (long i = 0; i < length; i++)     {         fin.read((char*)&list[i], sizeof(int));     }     fin.close(); } void bubbleSort() {     int temp;     for(long i = 0; i < length; i++)     {         for(long j = 0; j< length-i-1; j++)...

  • NEED HELP WITH MY C++ ASSIGNMENT, IT NEEDS TO BE SOLVED USING LISTS #include <iostream> #include...

    NEED HELP WITH MY C++ ASSIGNMENT, IT NEEDS TO BE SOLVED USING LISTS #include <iostream> #include <list> #include <map> #include <string> using namespace std; class course { public: string name; int section; int credits; course() {} course(string n, int s, int c) { name = n; section = s; credits = c; } //Add additional needed member functions and implement them. //You also need to implement some needed functions for overloading operator<< . }; //Implement the following functions void add_student(map<int,...

  • I wrote this code but there’s an issue with it : #include <iostream> #include <vector&...

    I wrote this code but there’s an issue with it : #include <iostream> #include <vector> #include <string> #include <fstream> using namespace std; class Borrower { private: string ID, name; public: Borrower() :ID("0"), name("no name yet") {} void setID(string nID); void setName(string nID); string getID(); string getName(); }; void Borrower::setID(string nID) { ID = nID; } void Borrower::setName(string nname) { name = nname; } string Borrower::getID() { return ID; } string Borrower::getName() { return name; } class Book { private: string...

  • Change the the following C++ codes to list the "marks" reported Alphabetically. --------------------------------------------------------------------------------------------------------- #include <iostream> #include<string.h>...

    Change the the following C++ codes to list the "marks" reported Alphabetically. --------------------------------------------------------------------------------------------------------- #include <iostream> #include<string.h> using namespace std; void display(int marks[10]); int main() { int marks[10]; int i;x for (i=0; i<10; i++) { cout << "Enter marks : "; cin >> marks[i]; } display(marks); return 0; } // Create the function sort to sort the marks in alphabetical order void display(int marks[10]) { cout <<"Displaying marks in Ascending Order " << endl; for (int i = 0; i <10;...

  • Programming C....... function code is clear but compile is wrong .. I input 8 and compiled...

    Programming C....... function code is clear but compile is wrong .. I input 8 and compiled 2 0 1 1 2 3 5 8 13.. look first number 2 is wrong. The correct answer 8 is 0 1 1 2 3 5 8 13 21.. Need fix code to compile correctly.. Here code.c --------------------------------------------------------------------------------------------------------------------- #include <stdio.h> #include <math.h> int fibonacciIterative( int n ) { int fib[1000]; int i; fib[ 0 ] = 0; fib[ 1 ] = 1; for (...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT