Program Environment Solutions - D Programming Language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Discord (community-run)
  - Forums
  - IRC
  - Wiki
  - Issues
  - Contributing
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# Program Environment Solutions

#### Program Environment Dersi Problem Çözümleri

1.     import std.stdio;
       import std.conv;

       int main(string[] args) {
           if (args.length != 4) {
               stderr.writeln(
                   "ERROR! Usage: \n    ", args[0],
                   " a_number operator another_number");
               return 1;
           }

           immutable first = to!double(args[1]);
           string op = args[2];
           immutable second = to!double(args[3]);

           switch (op) {

           case "+":
               writeln(first + second);
               break;

           case "-":
               writeln(first - second);
               break;

           case "x":
               writeln(first * second);
               break;

           case "/":
               writeln(first / second);
               break;

           default:
               throw new Exception("Invalid operator: " ~ op);
           }

           return 0;
       }

2.     import std.stdio;
       import std.process;

       void main() {
           write("Please enter the command line to execute: ");
           string commandLine = readln();

           writeln("The output: ", executeShell(commandLine));
       }

Copyright © 1999-2026 by the D Language Foundation | Page generated by Ddoc on Wed Aug 5 11:24:18 2026