help-please

Ecrire trois exemplaires d’un programme en C permettant de lancer la commande passée en argument en vous servant des trois fonctions prévues pour ce type d’opération.
Voici un exemple d’exécution possible en supposant que votre exécutable a pour nom « commande » :
kassouhuin@jik:~/Desktop/codes$ ./commande ls -l
total 48
-rw------- 1 kassouhuin kassouhuin 798 Apr 12 09:07 affichage_asynchrone.c
-rw------- 1 kassouhuin kassouhuin 529 Apr 12 22:12 affichage_simple.c
-rwxr-xr-x 1 kassouhuin kassouhuin 5098 Apr 12 09:11 compte_signal
-rw------- 1 kassouhuin kassouhuin 681 Apr 12 09:11 compte_signal.c
...When the title is in English, but the post is in what I believe is French...

What I am getting is that you're either coding in C and have a lot of issues, or the compiler has some problems with your object types or something, that are predefined in its C files.
sorry wait i will translate this
Write three copies of a C program to launch the order placed in argument by using the three functions for this type of operation.
Here is an implementation example, possible assuming your executable is called "control":
kassouhuin jik @: ~ / Desktop / codes ./commande $ ls -l
total 48
-rw ------- 1 kassouhuin kassouhuin 798 Apr 12 9:07 affichage_asynchrone.c
-rw ------- 1 kassouhuin kassouhuin 529 Apr 12 10:12 p.m. affichage_simple.c
-rwxr-xr-x 1 kassouhuin kassouhuin Apr 12 5098 9:11 compte_signal
-rw ------- 1 kassouhuin kassouhuin 681 Apr 12 9:11 compte_signal.c
Uh....ok I think you need to create functions that have parameters if I'm understanding the wording? Btw when you said translate, I didn't think you'd use Google Translate bruh.

If it is functions with parameters uhm..either you're wanting to pass in by value or by reference. I think.
can u do that for me?....am beginner in C....please
I guess. Never coded in C, but here goes nothing. Should be about the same anyways.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Example program
#include <iostream>
#include <string>

using namespace std;

int passValue( int valParam );
int passRef( int &refParam );

int main()
{
    int a, b;
    cout << "Enter integer a: ";
    cin >> a;
    cout << "And integer b: ";
    cin >> b;
    
    cout << "Original values of a is: " << a << endl;
    passValue( a );
    cout << "New value of a is: " << a << endl;
    
    cout << "Original value of b is: " << b << endl;
    passRef( b );
    cout << "New value of b is: " << b << endl;
    
    
    return 0;
}

int passValue( int valParam )
{
    return valParam += 5;
}
int passRef( int &refParam )
{
    return refParam += 3;
}


Run it and see what happens.
YFGHNG wrote:
Never coded in C, but here goes nothing. Should be about the same anyways.


Sorry buddy, that is not C. C does not have iostream, string , namespaces, cout references etc.

Instead, it has <stdio.h> , char arrays , printf , scanf , pointers to pass by reference etc.

@crazyoliver0

You must have some code of your own, your teacher wouldn't be asking you to do it unless they had been through enough theory and examples to do so.

Is that the full text of the assignment? If so, it might qualify for the worlds shortest IT assignment specification.

Does your teacher want you to make use of command line arguments argc , *argv[] ?

Are those c programs in your directory listing important for us to see, or is your program just going to call them directly?
@TheIdeasMan: oh ok thanks for the that. I knew something looked weird because I usually see #include<filename.h> instead of in c++ just the name of the library. But I didn't bother looking it up because I was tired, and the theory still applied, even if the syntax was wrong.

@OP: Here's what's up with the two functions I wrote, one with value and one with reference. Value creates a copy of the original variable, reference changes the original.
Topic archived. No new replies allowed.