{"id":21288716,"url":"https://github.com/abdo-essam/binarytodecimalusingstack","last_synced_at":"2025-03-15T15:42:40.480Z","repository":{"id":84703594,"uuid":"415691038","full_name":"abdo-essam/BinarytoDecimalUsingStack","owner":"abdo-essam","description":"Structured Programming Assignment","archived":false,"fork":false,"pushed_at":"2023-03-04T21:05:22.000Z","size":789,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T05:41:23.687Z","etag":null,"topics":["binary-to-decimal","decimal-to-binary","stack"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abdo-essam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-10T20:17:42.000Z","updated_at":"2023-03-04T21:06:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"fbda7643-834c-4986-a2c8-58a0991f7629","html_url":"https://github.com/abdo-essam/BinarytoDecimalUsingStack","commit_stats":null,"previous_names":["abdo-essam/binarytodecimalusingstack","abdo-essam/binarytodecimalbystack"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdo-essam%2FBinarytoDecimalUsingStack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdo-essam%2FBinarytoDecimalUsingStack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdo-essam%2FBinarytoDecimalUsingStack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abdo-essam%2FBinarytoDecimalUsingStack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abdo-essam","download_url":"https://codeload.github.com/abdo-essam/BinarytoDecimalUsingStack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243753995,"owners_count":20342537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-to-decimal","decimal-to-binary","stack"],"created_at":"2024-11-21T12:24:07.532Z","updated_at":"2025-03-15T15:42:40.453Z","avatar_url":"https://github.com/abdo-essam.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BinarytoDecimalByStack\n\n# Faculty Of Computer And Artificial Intelligence Cairo University `FCAI-CU`\n\n## \tStructured Programming Assignment\n\n\n\n## Explan:\n\ntakes an input from the user, either a decimal or binary number, and converts it to its binary or decimal equivalent, respectively.\n\nThe DecimalToBinary function takes an integer as an argument and uses a stack to store the binary digits of the input number. It repeatedly divides the input number by 2, pushes the remainder (which is always 0 or 1) onto the stack, and updates the input number to be the quotient. Once the input number becomes 0, the function prints out the binary equivalent by popping each digit off the stack and printing it out.\n\nThe BinaryToDecimal function takes a string as an argument and uses a stack to store the binary digits of the input number. It iterates over each character in the string and checks that it is either '0' or '1'. If it is, it pushes the corresponding integer (0 or 1) onto the stack. If it is not a binary digit, the function prints an error message and returns. Once all the binary digits have been pushed onto the stack, the function pops each digit off the stack and multiplies it by the appropriate power of 2, accumulating the result in a variable called Decimal. Once the stack is empty, the function prints out the decimal equivalent.\n\nIn the main function, the user is prompted to enter a decimal or binary number, and the appropriate function is called depending on the user's input. If the user enters a non-binary character for the binary input, the BinaryToDecimal function will print an error message and return without converting the number.\n\nOverall, this code correctly implements decimal-to-binary and binary-to-decimal conversion using stacks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdo-essam%2Fbinarytodecimalusingstack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdo-essam%2Fbinarytodecimalusingstack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdo-essam%2Fbinarytodecimalusingstack/lists"}