online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/*************************************************************** * Name: Rafael Orta * Course: Computer Science & Programming * Class: CS04103 Section: 5 & 6 * Assignment Date: 11/29/2022 * File Name: PassingStructToClass.cpp ***************************************************************** * Purpose: Demonstrate how to pass a struct to a class *****************************************************************/ #include "tst.h" // contains the struct declaration #include "Testing.h" // Class header #include <iostream> #include <string> using namespace std; int main() { TestingStr test; // Instantiating the struct test.name = "Rafael"; Testing a; // Instantiating the class a.printing(test); // Calling the class and passing the struct return 0; }
/*************************************************************** * Name: Rafael Orta * Course: Computer Science & Programming * Class: CS04103 Section: 5 & 6 * Assignment Date: 11/29/2022 * File Name: Testing.h ***************************************************************** * Purpose: Demonstrate how to pass a struct to a class *****************************************************************/ //#pragma once #ifndef TESTING_H #define TESTING class Testing // Class definition { public: // Modifier void printing(struct TestingStr); private: }; #endif // !TESTING_H
/*************************************************************** * Name: Rafael Orta * Course: Computer Science & Programming * Class: CS04103 Section: 5 & 6 * Assignment Date: 11/29/2022 * File Name: Testing.cpp ***************************************************************** * Purpose: Demonstrate how to pass a struct to a class *****************************************************************/ #include "Testing.h" // Class header file #include "tst.h" // Struct header file #include <iostream> using namespace std; void Testing::printing(TestingStr test) // Class member definition { cout << test.name; }
/*************************************************************** * Name: Rafael Orta * Course: Computer Science & Programming * Class: CS04103 Section: 5 & 6 * Assignment Date: 11/29/2022 * File Name: test.h ***************************************************************** * Purpose: Demonstrate how to pass a struct to a class *****************************************************************/ #include <string> using namespace std; struct TestingStr // Struct declaration { string name; };

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