Skip to content

Instantly share code, notes, and snippets.

@ahoNerd
Last active November 11, 2022 09:35
Show Gist options
  • Save ahoNerd/458611b19af8fca49401b5334976bb76 to your computer and use it in GitHub Desktop.
Save ahoNerd/458611b19af8fca49401b5334976bb76 to your computer and use it in GitHub Desktop.
Run and Compile C or C++ with Sublime Text, read more at https://ahonerd.com/run-and-compile-cpp-with-sublime-text
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
{
"cmd": ["g++.exe", "-std=c++14", "-o", "$file_base_name", "$file", "&&", "start", "cmd", "/c", "$file_base_name & echo. & echo. & pause"],
"shell": true,
"selector": "source.c++"
}
#include <stdio.h>
int main()
{
printf("Berhasil !!!");
return 0;
}
#include <iostream>
using namespace std;
int main() {
int num;
cout << "Masukkan integer: ";
cin >> num; // baca input dari user
cout << "Angka yang anda masukkan: " << num;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment