Commit b64f6f3c authored by Guillaume Anciaux's avatar Guillaume Anciaux
Browse files

Merge branch 'master' of ssh://c4science.ch/source/sp4e into master

parents 98d66ac7 347dded7
import sys
if (not len(sys.argv) == 2):
print("Not enough parameters for the program {0}".format(sys.argv[0]))
sys.exit()
print("sys.argv is of type {0}".format(type(sys.argv)))
prog_name = sys.argv[0]
N = sys.argv[1]
print("{0} says: Hello {1}".format(prog_name, N))
import sys
import series
def main():
if (not len(sys.argv) == 2):
print("Not enough parameters for the program {0}".format(sys.argv[0]))
return
print("sys.argv is of type {0}".format(type(sys.argv)))
prog_name = sys.argv[0]
N = int(sys.argv[1])
print("{0} says: Hello {1} {2}".format(
prog_name, series.computeSeries(N), N*(N+1)/2))
if __name__ == '__main__':
main()
def computeSeries(n):
res = 0
for i in range(1, n+1):
res += i
return res
cmake_minimum_required(VERSION 2.6)
project(hello-exercise)
add_executable(main main.cc)
/* -------------------------------------------------------------------------- */
#include <cstdlib>
#include <cmath>
#include <iostream>
/* -------------------------------------------------------------------------- */
void exo1(){
}
/* -------------------------------------------------------------------------- */
void exo2(){
}
/* -------------------------------------------------------------------------- */
void exo3(){
}
/* -------------------------------------------------------------------------- */
int main(int argc, char ** argv){
exo1();
exo2();
exo3();
return EXIT_SUCCESS;
}
cmake_minimum_required(VERSION 2.6)
project(hello-exercise)
add_executable(hello hello.cc)
#include <string>
#include <iostream>
#include "series.hh"
/* -------------------------------------------------------------------------- */
int main(int argc, char ** argv){
// write your code here
return EXIT_SUCCESS;
}
#include "series.hh"
int computeSeries(int Niteratrions){
//...
}
#ifndef SERIES_HH
#define SERIES_HH
int computeSeries(int Niterations);
#endif
cmake_minimum_required(VERSION 2.6)
project(hello-exercise)
add_executable(main main.cc)
/* -------------------------------------------------------------------------- */
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <iomanip>
/* -------------------------------------------------------------------------- */
int main(int argc, char ** argv){
// your code here
return EXIT_SUCCESS;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment