Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

This pull request significantly improves the C# to C++ translation quality by addressing several key transformation issues identified in issue #16.

Key Improvements

  • Boolean type transformation: Booleanbool
  • Input/Output improvements:
    • Console.ReadLine()std::getline(std::cin, variable)
    • Console.WriteLine(variable)std::cout << variable << std::endl
    • int.Parse(value)std::stoi(value)
  • Header includes: using System;#include <iostream> + #include <string>

Example Transformation

Before:

using System;
class Program {
    public static Boolean func(int x1, int x2, int y1, int y2) {
        Boolean first = true;
        if(x1*x1 + y1*y1 > x2*x2 + y2*y2) {
            first = false;
        }
        return first;
    }
    
    static void Main(string[] args) {
        string line = Console.ReadLine();
        int number = int.Parse(line);
        Console.WriteLine(number);
    }
}

After:

#include <iostream>
#include <string>

class Program {
    public: static bool func(std::int32_t x1, std::int32_t x2, std::int32_t y1, std::int32_t y2) {
        bool first = true;
        if(x1*x1 + y1*y1 > x2*x2 + y2*y2) {
            first = false;
        }
        return first;
    }
    
    public: static void Main(std::string args[]) {
        std::string line = 0;
        std::getline(std::cin, line);
        std::int32_t number = std::stoi(line);
        std::cout << number << std::endl;
    }
};

Test Plan

  • All existing tests pass
  • Added comprehensive test cases for Boolean type transformations
  • Added test cases for I/O transformations
  • Verified backward compatibility with existing transformations

🤖 Generated with Claude Code


Resolves #16

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #16
@konard konard self-assigned this Sep 14, 2025
- Add Boolean to bool type transformation
- Add int.Parse() to std::stoi() transformation
- Add Console.ReadLine() to std::getline() transformation
- Add Console.WriteLine() to std::cout transformation for variables
- Add using System; to #include <iostream> and #include <string> transformation
- Add comprehensive test cases for Boolean type and I/O transformations
- Update existing HelloWorld test to expect proper includes

These improvements significantly enhance the translation quality for common
C# constructs, addressing the issues raised in GitHub issue #16.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Improve translation quality for example Improve translation quality for C# to C++ transformer Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve translation quality for example

1 participant