Prompt Details
Model
Chat - GPT-3.5 (gpt-3.5-turbo)
Token size
53 ($0.00010 / call)
Example input
Create a program called (sum) using the (obcject-oriented paradigm), which includes (2) variables of type (int). The program performs (sum numbers) and displays the output on the screen.
Example output
#include <iostream>
class Sum {
private:
int num1;
int num2;
public:
Sum(int n1, int n2) {
num1 = n1;
num2 = n2;
}
void performSum() {
int sum = num1 + num2;
std::cout << "The sum of " << num1 << " and " << num2 << " is: " << sum << std::endl;
}
};
int main() {
// Creating an instance of the Sum class
Sum sumInstance(10, 5);
// Performing the sum and printing the result
sumInstance.performSum();
return 0;
}