summaryrefslogtreecommitdiff
path: root/testapp/c_cpp_files
diff options
context:
space:
mode:
authorprathamesh2013-07-02 15:52:59 +0530
committerprathamesh2013-07-02 15:52:59 +0530
commiteee6362ab994bc0082fdc777c225773318978b1a (patch)
treec13413332892dd57324ecec12e30321335b7701b /testapp/c_cpp_files
parent217f2c859fc0b2b4a224c009e9cd374989da050e (diff)
downloadonline_test-eee6362ab994bc0082fdc777c225773318978b1a.tar.gz
online_test-eee6362ab994bc0082fdc777c225773318978b1a.tar.bz2
online_test-eee6362ab994bc0082fdc777c225773318978b1a.zip
minor changes
Diffstat (limited to 'testapp/c_cpp_files')
-rwxr-xr-xtestapp/c_cpp_files/main.cpp4
-rwxr-xr-xtestapp/c_cpp_files/main2.c6
-rwxr-xr-xtestapp/c_cpp_files/main_array_sum.cpp8
-rwxr-xr-xtestapp/c_cpp_files/main_fact.cpp4
-rwxr-xr-xtestapp/c_cpp_files/main_greatest.cpp14
-rwxr-xr-xtestapp/c_cpp_files/main_palindrome.cpp4
6 files changed, 31 insertions, 9 deletions
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;