From 041064618c290b50bd7ea213c4535b1f585d0f03 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Wed, 5 Jun 2013 17:28:58 +0530 Subject: c_cpp_files --- testapp/c_cpp_files/add.c | 4 ++++ testapp/c_cpp_files/add.cpp | 6 ++++++ testapp/c_cpp_files/array_sum.c | 10 ++++++++++ testapp/c_cpp_files/array_sum.cpp | 10 ++++++++++ testapp/c_cpp_files/fact.c | 10 ++++++++++ testapp/c_cpp_files/fact.cpp | 16 ++++++++++++++++ testapp/c_cpp_files/greatest.c | 15 +++++++++++++++ testapp/c_cpp_files/greatest.cpp | 15 +++++++++++++++ testapp/c_cpp_files/hello_name.c | 16 ++++++++++++++++ testapp/c_cpp_files/main.cpp | 30 ++++++++++++++++++++++++++++++ testapp/c_cpp_files/main2.c | 28 ++++++++++++++++++++++++++++ testapp/c_cpp_files/main_array_sum.cpp | 32 ++++++++++++++++++++++++++++++++ testapp/c_cpp_files/main_fact.cpp | 30 ++++++++++++++++++++++++++++++ testapp/c_cpp_files/main_greatest.cpp | 32 ++++++++++++++++++++++++++++++++ testapp/c_cpp_files/main_hello_name.c | 29 +++++++++++++++++++++++++++++ testapp/c_cpp_files/main_palindrome.cpp | 30 ++++++++++++++++++++++++++++++ testapp/c_cpp_files/palindrome.c | 20 ++++++++++++++++++++ testapp/c_cpp_files/palindrome.cpp | 19 +++++++++++++++++++ testapp/c_cpp_files/sample.c | 20 ++++++++++++++++++++ testapp/c_cpp_files/sample.cpp | 7 +++++++ 20 files changed, 379 insertions(+) create mode 100644 testapp/c_cpp_files/add.c create mode 100644 testapp/c_cpp_files/add.cpp create mode 100644 testapp/c_cpp_files/array_sum.c create mode 100644 testapp/c_cpp_files/array_sum.cpp create mode 100644 testapp/c_cpp_files/fact.c create mode 100644 testapp/c_cpp_files/fact.cpp create mode 100644 testapp/c_cpp_files/greatest.c create mode 100644 testapp/c_cpp_files/greatest.cpp create mode 100644 testapp/c_cpp_files/hello_name.c create mode 100755 testapp/c_cpp_files/main.cpp create mode 100755 testapp/c_cpp_files/main2.c create mode 100755 testapp/c_cpp_files/main_array_sum.cpp create mode 100755 testapp/c_cpp_files/main_fact.cpp create mode 100755 testapp/c_cpp_files/main_greatest.cpp create mode 100755 testapp/c_cpp_files/main_hello_name.c create mode 100755 testapp/c_cpp_files/main_palindrome.cpp create mode 100644 testapp/c_cpp_files/palindrome.c create mode 100644 testapp/c_cpp_files/palindrome.cpp create mode 100755 testapp/c_cpp_files/sample.c create mode 100755 testapp/c_cpp_files/sample.cpp (limited to 'testapp/c_cpp_files') diff --git a/testapp/c_cpp_files/add.c b/testapp/c_cpp_files/add.c new file mode 100644 index 0000000..c829971 --- /dev/null +++ b/testapp/c_cpp_files/add.c @@ -0,0 +1,4 @@ +int add(int a,int b) +{ + return a-b; +} diff --git a/testapp/c_cpp_files/add.cpp b/testapp/c_cpp_files/add.cpp new file mode 100644 index 0000000..d3b7897 --- /dev/null +++ b/testapp/c_cpp_files/add.cpp @@ -0,0 +1,6 @@ +#include +int add(int a,int b) +{ + printf("All Correct"); + return a; +} diff --git a/testapp/c_cpp_files/array_sum.c b/testapp/c_cpp_files/array_sum.c new file mode 100644 index 0000000..619a23c --- /dev/null +++ b/testapp/c_cpp_files/array_sum.c @@ -0,0 +1,10 @@ +int array_sum(int a[5]) +{ + int i=0, sum=0; + for(i=0;i<5;i++) + { + sum = sum + a[i]; + } + return sum; +} + diff --git a/testapp/c_cpp_files/array_sum.cpp b/testapp/c_cpp_files/array_sum.cpp new file mode 100644 index 0000000..9b82d3b --- /dev/null +++ b/testapp/c_cpp_files/array_sum.cpp @@ -0,0 +1,10 @@ +int array_sum(int a[]) +{ + int i=0, sum=0; + for(i=0;i<5;i++) + { + sum = sum + a[i]; + } + return sum; +} + diff --git a/testapp/c_cpp_files/fact.c b/testapp/c_cpp_files/fact.c new file mode 100644 index 0000000..e3665f5 --- /dev/null +++ b/testapp/c_cpp_files/fact.c @@ -0,0 +1,10 @@ +int factorial(int a) +{ + int i,fact=1; + for(i=1;i<=a;a--) + { + fact=fact*a; + } + return fact; + +} diff --git a/testapp/c_cpp_files/fact.cpp b/testapp/c_cpp_files/fact.cpp new file mode 100644 index 0000000..f9b7458 --- /dev/null +++ b/testapp/c_cpp_files/fact.cpp @@ -0,0 +1,16 @@ +#include +int fact = 1; +int factorial(int a) +{ + printf("%d\n",a); + if(a<1) + { + printf("\nfinal"); + return 1; + } + else + { + printf("count\n"); + return a*factorial(a-1); + } +} diff --git a/testapp/c_cpp_files/greatest.c b/testapp/c_cpp_files/greatest.c new file mode 100644 index 0000000..0194855 --- /dev/null +++ b/testapp/c_cpp_files/greatest.c @@ -0,0 +1,15 @@ +int greatest(int a,int b,int c) +{ + if(a>b && a>c) + { + return a; + } + else if(b>c) + { + return b; + } + else + { + return c; + } +} diff --git a/testapp/c_cpp_files/greatest.cpp b/testapp/c_cpp_files/greatest.cpp new file mode 100644 index 0000000..0194855 --- /dev/null +++ b/testapp/c_cpp_files/greatest.cpp @@ -0,0 +1,15 @@ +int greatest(int a,int b,int c) +{ + if(a>b && a>c) + { + return a; + } + else if(b>c) + { + return b; + } + else + { + return c; + } +} diff --git a/testapp/c_cpp_files/hello_name.c b/testapp/c_cpp_files/hello_name.c new file mode 100644 index 0000000..8fa2519 --- /dev/null +++ b/testapp/c_cpp_files/hello_name.c @@ -0,0 +1,16 @@ +#include +#include + +char *message(char a[]) +{ + return (strcat("hello",a)); +} + +main() +{ + printf("he\n"); + char q[]="re"; + char s[20]; + s= message(q); + printf("%s",s); +} diff --git a/testapp/c_cpp_files/main.cpp b/testapp/c_cpp_files/main.cpp new file mode 100755 index 0000000..ffd110e --- /dev/null +++ b/testapp/c_cpp_files/main.cpp @@ -0,0 +1,30 @@ +#include +#include + +extern int add(int, int); + +template + +void check(T expect, T result) +{ + if (expect == result) + { + //printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); + exit (1); + } +} + +int main(void) +{ + int result; + result = add(0,0); + check(0, result); + result = add(2,3); + check(5,result); + printf("All Correct\n"); + return 0; +} diff --git a/testapp/c_cpp_files/main2.c b/testapp/c_cpp_files/main2.c new file mode 100755 index 0000000..3d28ff6 --- /dev/null +++ b/testapp/c_cpp_files/main2.c @@ -0,0 +1,28 @@ +#include +#include + +extern int add(int, int, int); + +template +void check(T expect,T result) +{ + if (expect == result) + { + printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("Incorrect:\n Expected %d got %d \n",expect,result); + exit (0); + } +} + +int main(void) +{ + int result; + result = add(0,0,0); + check(0, result); + result = add(2,3,3); + check(8,result); + printf("All Correct\n"); +} diff --git a/testapp/c_cpp_files/main_array_sum.cpp b/testapp/c_cpp_files/main_array_sum.cpp new file mode 100755 index 0000000..72eee46 --- /dev/null +++ b/testapp/c_cpp_files/main_array_sum.cpp @@ -0,0 +1,32 @@ +#include +#include + +extern int array_sum(int []); + +template + +void check(T expect,T result) +{ + if (expect == result) + { + //printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); + exit (1); + } +} + +int main(void) +{ + int result; + int a[55555] = {1,2,3,0,0}; + result = array_sum(a); + check(6, result); + int b[] = {1,2,3,4,5}; + result = array_sum(b); + check(15,result); + printf("All Correct\n"); + return 0; +} diff --git a/testapp/c_cpp_files/main_fact.cpp b/testapp/c_cpp_files/main_fact.cpp new file mode 100755 index 0000000..ff65456 --- /dev/null +++ b/testapp/c_cpp_files/main_fact.cpp @@ -0,0 +1,30 @@ +#include +#include + +extern int factorial(int); + +template + +void check(T expect, T result) +{ + if (expect == result) + { + //printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); + exit (1); + } +} + +int main(void) +{ + int result; + result = factorial(0); + check(1, result); + result = factorial(3); + check(6, result); + printf("All Correct\n"); + return 0; +} diff --git a/testapp/c_cpp_files/main_greatest.cpp b/testapp/c_cpp_files/main_greatest.cpp new file mode 100755 index 0000000..fe9ff5b --- /dev/null +++ b/testapp/c_cpp_files/main_greatest.cpp @@ -0,0 +1,32 @@ +#include +#include + +extern int greatest(int, int, int); + +template + +void check(T expect, T result) +{ + if (expect == result) + { + //printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); + exit (1); + } +} + +int main(void) +{ + int result; + result = greatest(1, 2, 3); + check(3, result); + result = greatest(5, 9, 2); + check(9, result); + result = greatest(7, 2, 4); + check(7, result); + printf("All Correct\n"); + return 0; +} diff --git a/testapp/c_cpp_files/main_hello_name.c b/testapp/c_cpp_files/main_hello_name.c new file mode 100755 index 0000000..71b83a2 --- /dev/null +++ b/testapp/c_cpp_files/main_hello_name.c @@ -0,0 +1,29 @@ +#include +#include + + +void check(char expect[], char result[]) +{ + if (expect == result) + { + printf("Correct:expected %s got %s \n",expect,result); + } + else + { + printf("ERROR:expected %s got %s \n",expect,result); + exit (0); + } +} + +int main(void) +{ + char result[20]; + char A[20]=" pratham"; + char B[20]=" sir"; + result[20] = message(A); + printf("%s",result); + check("hello pratham", result); + result[20] = message(B); + check("hello sir",result); + printf("All Correct\n"); +} diff --git a/testapp/c_cpp_files/main_palindrome.cpp b/testapp/c_cpp_files/main_palindrome.cpp new file mode 100755 index 0000000..a5d67b5 --- /dev/null +++ b/testapp/c_cpp_files/main_palindrome.cpp @@ -0,0 +1,30 @@ +#include +#include + +extern bool palindrome(int); + +template + +void check(T expect, T result) +{ + if (expect == result) + { + //printf("Correct:\n Expected %d got %d \n",expect,result); + } + else + { + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); + exit (1); + } +} + +int main(void) +{ + bool result; + result = palindrome(123); + check(false, result); + result = palindrome(121); + check(true, result); + printf("All Correct\n"); + return 0; +} diff --git a/testapp/c_cpp_files/palindrome.c b/testapp/c_cpp_files/palindrome.c new file mode 100644 index 0000000..236d963 --- /dev/null +++ b/testapp/c_cpp_files/palindrome.c @@ -0,0 +1,20 @@ +#include +bool palindrome(int a) +{ + int n1, rev = 0, rem; + n1 = a; + while (a > 0) + { + rem = a % 10; + rev = rev * 10 + rem; + a = a / 10; + } + if (n1 == rev) + { + return true; + } + else + { + return false; + } +} diff --git a/testapp/c_cpp_files/palindrome.cpp b/testapp/c_cpp_files/palindrome.cpp new file mode 100644 index 0000000..aae5dd1 --- /dev/null +++ b/testapp/c_cpp_files/palindrome.cpp @@ -0,0 +1,19 @@ +bool palindrome(int n) +{ + int n1, rev = 0, rem; + n1 = n; + while (n > 0) + { + rem = n % 10; + rev = rev * 10 + rem; + n = n / 10; + } + if (n1 == rev) + { + return true; + } + else + { + return false; + } +} diff --git a/testapp/c_cpp_files/sample.c b/testapp/c_cpp_files/sample.c new file mode 100755 index 0000000..660f862 --- /dev/null +++ b/testapp/c_cpp_files/sample.c @@ -0,0 +1,20 @@ +#include + +void main(int argc , char * argv[]) +{ + int i,sum=0; + +/* if(argc!=3) + { + printf("you have forgot to type numbers."); + exit(1); + } +*/ + printf("The sum is : "); + + for(i=1;i +#include +int main(int argc, char* argv[]) +{ + std::cout << atoi(argv[1])+atoi(argv[2]) << std::endl; + return 0; +} -- cgit From 8a3016a88af5c4a09e8b5683f1e305e9100f3562 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 2 Jul 2013 12:25:33 +0530 Subject: c files moved --- testapp/c_cpp_files/add.c | 4 ---- testapp/c_cpp_files/add.cpp | 6 ------ testapp/c_cpp_files/array_sum.c | 10 ---------- testapp/c_cpp_files/array_sum.cpp | 10 ---------- testapp/c_cpp_files/fact.c | 10 ---------- testapp/c_cpp_files/fact.cpp | 16 ---------------- testapp/c_cpp_files/greatest.c | 15 --------------- testapp/c_cpp_files/greatest.cpp | 15 --------------- testapp/c_cpp_files/hello_name.c | 16 ---------------- testapp/c_cpp_files/palindrome.c | 20 -------------------- testapp/c_cpp_files/palindrome.cpp | 19 ------------------- 11 files changed, 141 deletions(-) delete mode 100644 testapp/c_cpp_files/add.c delete mode 100644 testapp/c_cpp_files/add.cpp delete mode 100644 testapp/c_cpp_files/array_sum.c delete mode 100644 testapp/c_cpp_files/array_sum.cpp delete mode 100644 testapp/c_cpp_files/fact.c delete mode 100644 testapp/c_cpp_files/fact.cpp delete mode 100644 testapp/c_cpp_files/greatest.c delete mode 100644 testapp/c_cpp_files/greatest.cpp delete mode 100644 testapp/c_cpp_files/hello_name.c delete mode 100644 testapp/c_cpp_files/palindrome.c delete mode 100644 testapp/c_cpp_files/palindrome.cpp (limited to 'testapp/c_cpp_files') diff --git a/testapp/c_cpp_files/add.c b/testapp/c_cpp_files/add.c deleted file mode 100644 index c829971..0000000 --- a/testapp/c_cpp_files/add.c +++ /dev/null @@ -1,4 +0,0 @@ -int add(int a,int b) -{ - return a-b; -} diff --git a/testapp/c_cpp_files/add.cpp b/testapp/c_cpp_files/add.cpp deleted file mode 100644 index d3b7897..0000000 --- a/testapp/c_cpp_files/add.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include -int add(int a,int b) -{ - printf("All Correct"); - return a; -} diff --git a/testapp/c_cpp_files/array_sum.c b/testapp/c_cpp_files/array_sum.c deleted file mode 100644 index 619a23c..0000000 --- a/testapp/c_cpp_files/array_sum.c +++ /dev/null @@ -1,10 +0,0 @@ -int array_sum(int a[5]) -{ - int i=0, sum=0; - for(i=0;i<5;i++) - { - sum = sum + a[i]; - } - return sum; -} - diff --git a/testapp/c_cpp_files/array_sum.cpp b/testapp/c_cpp_files/array_sum.cpp deleted file mode 100644 index 9b82d3b..0000000 --- a/testapp/c_cpp_files/array_sum.cpp +++ /dev/null @@ -1,10 +0,0 @@ -int array_sum(int a[]) -{ - int i=0, sum=0; - for(i=0;i<5;i++) - { - sum = sum + a[i]; - } - return sum; -} - diff --git a/testapp/c_cpp_files/fact.c b/testapp/c_cpp_files/fact.c deleted file mode 100644 index e3665f5..0000000 --- a/testapp/c_cpp_files/fact.c +++ /dev/null @@ -1,10 +0,0 @@ -int factorial(int a) -{ - int i,fact=1; - for(i=1;i<=a;a--) - { - fact=fact*a; - } - return fact; - -} diff --git a/testapp/c_cpp_files/fact.cpp b/testapp/c_cpp_files/fact.cpp deleted file mode 100644 index f9b7458..0000000 --- a/testapp/c_cpp_files/fact.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -int fact = 1; -int factorial(int a) -{ - printf("%d\n",a); - if(a<1) - { - printf("\nfinal"); - return 1; - } - else - { - printf("count\n"); - return a*factorial(a-1); - } -} diff --git a/testapp/c_cpp_files/greatest.c b/testapp/c_cpp_files/greatest.c deleted file mode 100644 index 0194855..0000000 --- a/testapp/c_cpp_files/greatest.c +++ /dev/null @@ -1,15 +0,0 @@ -int greatest(int a,int b,int c) -{ - if(a>b && a>c) - { - return a; - } - else if(b>c) - { - return b; - } - else - { - return c; - } -} diff --git a/testapp/c_cpp_files/greatest.cpp b/testapp/c_cpp_files/greatest.cpp deleted file mode 100644 index 0194855..0000000 --- a/testapp/c_cpp_files/greatest.cpp +++ /dev/null @@ -1,15 +0,0 @@ -int greatest(int a,int b,int c) -{ - if(a>b && a>c) - { - return a; - } - else if(b>c) - { - return b; - } - else - { - return c; - } -} diff --git a/testapp/c_cpp_files/hello_name.c b/testapp/c_cpp_files/hello_name.c deleted file mode 100644 index 8fa2519..0000000 --- a/testapp/c_cpp_files/hello_name.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -char *message(char a[]) -{ - return (strcat("hello",a)); -} - -main() -{ - printf("he\n"); - char q[]="re"; - char s[20]; - s= message(q); - printf("%s",s); -} diff --git a/testapp/c_cpp_files/palindrome.c b/testapp/c_cpp_files/palindrome.c deleted file mode 100644 index 236d963..0000000 --- a/testapp/c_cpp_files/palindrome.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -bool palindrome(int a) -{ - int n1, rev = 0, rem; - n1 = a; - while (a > 0) - { - rem = a % 10; - rev = rev * 10 + rem; - a = a / 10; - } - if (n1 == rev) - { - return true; - } - else - { - return false; - } -} diff --git a/testapp/c_cpp_files/palindrome.cpp b/testapp/c_cpp_files/palindrome.cpp deleted file mode 100644 index aae5dd1..0000000 --- a/testapp/c_cpp_files/palindrome.cpp +++ /dev/null @@ -1,19 +0,0 @@ -bool palindrome(int n) -{ - int n1, rev = 0, rem; - n1 = n; - while (n > 0) - { - rem = n % 10; - rev = rev * 10 + rem; - n = n / 10; - } - if (n1 == rev) - { - return true; - } - else - { - return false; - } -} -- cgit From 217f2c859fc0b2b4a224c009e9cd374989da050e Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 2 Jul 2013 13:24:00 +0530 Subject: clean C and Cpp --- testapp/c_cpp_files/sample.c | 20 -------------------- testapp/c_cpp_files/sample.cpp | 7 ------- 2 files changed, 27 deletions(-) delete mode 100755 testapp/c_cpp_files/sample.c delete mode 100755 testapp/c_cpp_files/sample.cpp (limited to 'testapp/c_cpp_files') diff --git a/testapp/c_cpp_files/sample.c b/testapp/c_cpp_files/sample.c deleted file mode 100755 index 660f862..0000000 --- a/testapp/c_cpp_files/sample.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -void main(int argc , char * argv[]) -{ - int i,sum=0; - -/* if(argc!=3) - { - printf("you have forgot to type numbers."); - exit(1); - } -*/ - printf("The sum is : "); - - for(i=1;i -#include -int main(int argc, char* argv[]) -{ - std::cout << atoi(argv[1])+atoi(argv[2]) << std::endl; - return 0; -} -- cgit From eee6362ab994bc0082fdc777c225773318978b1a Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 2 Jul 2013 15:52:59 +0530 Subject: minor changes --- testapp/c_cpp_files/main.cpp | 4 +++- testapp/c_cpp_files/main2.c | 6 ++++-- testapp/c_cpp_files/main_array_sum.cpp | 8 +++++--- testapp/c_cpp_files/main_fact.cpp | 4 +++- testapp/c_cpp_files/main_greatest.cpp | 14 +++++++++++++- testapp/c_cpp_files/main_palindrome.cpp | 4 +++- 6 files changed, 31 insertions(+), 9 deletions(-) (limited to 'testapp/c_cpp_files') diff --git a/testapp/c_cpp_files/main.cpp b/testapp/c_cpp_files/main.cpp index ffd110e..ebe1f08 100755 --- a/testapp/c_cpp_files/main.cpp +++ b/testapp/c_cpp_files/main.cpp @@ -9,7 +9,7 @@ void check(T expect, T result) { if (expect == result) { - //printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { @@ -22,8 +22,10 @@ int main(void) { int result; result = add(0,0); + printf("Input submitted to the function: 0, 0"); check(0, result); result = add(2,3); + printf("Input submitted to the function: 2 3"); check(5,result); printf("All Correct\n"); return 0; diff --git a/testapp/c_cpp_files/main2.c b/testapp/c_cpp_files/main2.c index 3d28ff6..ccd1768 100755 --- a/testapp/c_cpp_files/main2.c +++ b/testapp/c_cpp_files/main2.c @@ -8,11 +8,11 @@ void check(T expect,T result) { if (expect == result) { - printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { - printf("Incorrect:\n Expected %d got %d \n",expect,result); + printf("\nIncorrect:\n Expected %d got %d \n",expect,result); exit (0); } } @@ -21,8 +21,10 @@ int main(void) { int result; result = add(0,0,0); + printf("Input submitted to the function: 0, 0, 0"); check(0, result); result = add(2,3,3); + printf("Input submitted to the function: 2, 3, 3"); check(8,result); printf("All Correct\n"); } diff --git a/testapp/c_cpp_files/main_array_sum.cpp b/testapp/c_cpp_files/main_array_sum.cpp index 72eee46..55b2ebf 100755 --- a/testapp/c_cpp_files/main_array_sum.cpp +++ b/testapp/c_cpp_files/main_array_sum.cpp @@ -9,7 +9,7 @@ void check(T expect,T result) { if (expect == result) { - //printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { @@ -21,11 +21,13 @@ void check(T expect,T result) int main(void) { int result; - int a[55555] = {1,2,3,0,0}; + int a[] = {1,2,3,0,0}; result = array_sum(a); + printf("Input submitted to the function: {1, 2, 3, 0, 0}"); check(6, result); int b[] = {1,2,3,4,5}; - result = array_sum(b); + result = array_sum(b); + printf("Input submitted to the function: {1, 2, 3, 4, 5}"); check(15,result); printf("All Correct\n"); return 0; diff --git a/testapp/c_cpp_files/main_fact.cpp b/testapp/c_cpp_files/main_fact.cpp index ff65456..a4ff230 100755 --- a/testapp/c_cpp_files/main_fact.cpp +++ b/testapp/c_cpp_files/main_fact.cpp @@ -9,7 +9,7 @@ void check(T expect, T result) { if (expect == result) { - //printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { @@ -22,8 +22,10 @@ int main(void) { int result; result = factorial(0); + printf("Input submitted to the function: 0"); check(1, result); result = factorial(3); + printf("Input submitted to the function: 3"); check(6, result); printf("All Correct\n"); return 0; diff --git a/testapp/c_cpp_files/main_greatest.cpp b/testapp/c_cpp_files/main_greatest.cpp index fe9ff5b..6d0a7c2 100755 --- a/testapp/c_cpp_files/main_greatest.cpp +++ b/testapp/c_cpp_files/main_greatest.cpp @@ -9,7 +9,7 @@ void check(T expect, T result) { if (expect == result) { - //printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { @@ -22,11 +22,23 @@ int main(void) { int result; result = greatest(1, 2, 3); + printf("Input submitted to the function: 1, 2, 3"); check(3, result); result = greatest(5, 9, 2); + printf("Input submitted to the function: 5, 9, 2"); check(9, result); result = greatest(7, 2, 4); + printf("Input submitted to the function: 7, 2, 4"); check(7, result); + result = greatest(11, 2, 45); + printf("Input submitted to the function: 11, 2, 45"); + check(45, result); + result = greatest(2, 7, 0); + printf("Input submitted to the function: 2, 7, 0"); + check(7, result); + result = greatest(9, 6, 5); + printf("Input submitted to the function: 9, 6, 5"); + check(9, result); printf("All Correct\n"); return 0; } diff --git a/testapp/c_cpp_files/main_palindrome.cpp b/testapp/c_cpp_files/main_palindrome.cpp index a5d67b5..0e66928 100755 --- a/testapp/c_cpp_files/main_palindrome.cpp +++ b/testapp/c_cpp_files/main_palindrome.cpp @@ -9,7 +9,7 @@ void check(T expect, T result) { if (expect == result) { - //printf("Correct:\n Expected %d got %d \n",expect,result); + printf("\nCorrect:\n Expected %d got %d \n",expect,result); } else { @@ -22,8 +22,10 @@ int main(void) { bool result; result = palindrome(123); + printf("Input submitted to the function: 123"); check(false, result); result = palindrome(121); + printf("Input submitted to the function: 121"); check(true, result); printf("All Correct\n"); return 0; -- cgit