Skip to content
Sign upLog in
← Back to Community

Import code files to repl

Profile icon
PaulLeger

Hi, I am professor and want to import source code files (C++'s examples) and later share with my students, Is it possible?

Answered by 21natzil [earned 5 cycles]
View Answer
Voters
Profile icon
furkanozer
Profile icon
JULIANCAMILOC12
Profile icon
michaelm0324
Profile icon
Leansutton
Profile icon
MattiaSanti
Profile icon
geofflangenderf
Profile icon
ronakgorasia
Profile icon
vkxleTTV
Profile icon
SophiaFriedman
Profile icon
WooyoungKim1
Comments
hotnewtop
Profile icon
21natzil

You can upload files from your computer into a repl, and then have your students fork the repl, so each receives the same copy.

Profile icon
PaulLeger

@21natzil
Thanks ... I found the way!

Profile icon
HasanGonen

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.undo.UndoManager;

public class UndoDemo extends JFrame {

private UndoManager undo = new UndoManager(); private JTextArea textArea = new JTextArea(); public UndoDemo() { super("Undo Redo"); LinkedList<String> cars = new LinkedList<String>(); Container cp = getContentPane(); cp.add(textArea = new JTextArea(10, 30), BorderLayout.CENTER); JPanel bp; cp.add(bp = new JPanel(), BorderLayout.SOUTH); undo = new UndoManager(); textArea.getDocument().addUndoableEditListener(undo); JButton undoButton; bp.add(undoButton = new JButton("UNDO")); //cars.add(textArea); undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (undo.canUndo()) { undo.undo(); } else { warn("Geri alinamaz"); } } }); JButton redoButton; bp.add(redoButton = new JButton("REDO")); redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (undo.canRedo()) { undo.redo(); } else { warn("Ileri alinamaz"); } } }); pack(); setDefaultCloseOperation(EXIT_ON_CLOSE); } void warn(String msg) { JOptionPane.showMessageDialog(this, "ERROR: " + msg, "ERROR", JOptionPane.WARNING_MESSAGE); } public static void main(String[] files) { /* cars.add("BMW"); cars.add("Ford"); cars.add("Mazda"); System.out.println(cars);

*/

new UndoDemo().setVisible(true); }

}

Profile icon
[deleted]

Invalid image url

Profile icon
RakeshRK9299

Invalid image url

Invalid image url

Invalid image url

Invalid image url

Profile icon
leon332157

You can create a new repl and upload your code to it.

Profile icon
PaulLeger

@leon332157
But, I have around 35 files because during a semester I teach many pieces of code. It is possible to upload a batch of sources code?

Profile icon
Mosrod

@PaulLeger
Yes, you can upload a folder of source code, and make your students fork that repl in the beginning of a semester, and they will have one repl for the whole semester with all of their files.
Cannot infer image mime type

Profile icon
PaulLeger

@Mosrod
Yes, it is very useful!!!

Following this method, I have many files and want to compile/execute in an isolated way. Is it possible?

Profile icon
Mosrod

@PaulLeger
I don't think so, repl.it might add it in the future, but for now, you can rename the file that you want to run to 'main.py'.

Profile icon
Mitchelle_RR

@Mosrod
I don't see that option to add folders!! I don't know why.
Cannot infer image mime type