online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ //Nirali Patel //Ucid:np92 #include <iostream> #include <string> #include <fstream> #include <stack> using namespace std; //userChoice function void userChoice() { //variables declaration string str; char user_input; int max_n; //First your program asks the user if s/he wants to enter a string. The user then enters //“y” for “yes”, or “n” for “no” for(int i = 0; i < max_n; i++){ cout<<"Do you want to enter a string?"<<endl; cin>>user_input; //checks if user enter 'y', user needs to enter a string over alphabet and read the string and print it if(user_input == 'y') { cout<<"please enter a string over alphabet:"<<endl; cin>> str; } //reads the string over alphabet //prints the string cout<<"The string read is: "<<str<<endl; //checks if user enters 'n', the program terminates if(user_input == 'n') { cout<<"Program terminates...."<<endl; exit(0); } //if the user neither enters 'y' and 'n', the program asks again to enter a string while(user_input != 'y' && user_input != 'n') { cout<<"wrong input. Please try again"<<endl; cin>>user_input; } } } //Program processes the string on PDA void PDA_implementation() { int start_state = '%'; int n = 5; int array[100] = {'%', '+', '-', '*', '/', '(', ')', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; if(start_state == '%'){ //prints out the start state of the PDA cout<<"The start state of PDA is: "<< start_state <<endl; } } //PDA transition //push function void push(){ int array[100] = {'%', '+', '-', '*', '/', '(', ')', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; string str; if(str == "%"){ array[0]++; cout<<"The symbol that was read was: "<<str<<endl; } } //pop function void pop(){ } //main function int main() { stack <int> mystack; int count = 1; //Prints project 2, section number, semester, written by, & Instructor: Marvin Nakayama, [email protected] cout<<"Project 2 for CS 341"<<endl; cout<<"Section number: 007"<<endl; cout<<"Semester: Fall 2022"<<endl; cout<<"Written by: Nirali Patel"<<endl; cout<<"Instructor: Marvin Nakayama, [email protected]"<<endl; //function calls userChoice(); PDA_implementation(); push(); pop(); //push operation mystack.push('%'); mystack.push('-'); mystack.push('/'); mystack.push(')'); mystack.push('.'); mystack.push('x'); mystack.push(0); mystack.push(2); mystack.push(4); mystack.push(6); mystack.push(8); //pop operation mystack.pop(); return 0; }
y %381.5886% y %.8+7.-8.00/90.765+% y %7956.+.492*341.2/060.10/52581.263-.9+.53/7.% y %382.89*34% y %4.239-.*7.29% y %6.88.6+32.208% y %(1.2+(3.4-.9)/39).3% y %(.3)64% y %((824.23+(9.22-00.0)*21.2))+((.2/7.))% y %(())% y %((14.252+(692.211*(.39+492.1))/49.235)% y %+6.5% y %26.0*(.87/((4.+.2)/(23.531)-2.9)+6.)/(((823.*.333-57.*8.0)/.33+.0))% y %.0*(32.922+.7-*9.))% y %(4.+(.8-9.))/2.)*3.4+(5.21/34.2% n

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue