Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close #3 return value #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CPP001_First_Program.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include<iostream>
using namespace std;

main()
int main()
{
cout<<"Hello World !";

return 0;
}
4 changes: 3 additions & 1 deletion CPP002_Variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace std;

main()
int main()
{
//Declaring an integer type variable A, allocates 4 bytes of memory.
int A=4;
Expand All @@ -23,4 +23,6 @@ main()
A=10;
cout<<A <<endl;
cout<<&A;

return 0;
}
3 changes: 2 additions & 1 deletion CPP003_Variables_Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace std;

main()
int main()
{
int a=10,b=35; // 4 bytes
cout<<"Value of a : "<<a<<" Address of a : "<<&a <<endl;
Expand Down Expand Up @@ -44,4 +44,5 @@ main()
const string myname="Tridib";
cout << myname << endl;

return 0;
}
3 changes: 2 additions & 1 deletion CPP004_Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace std;

main()
int main()
{
// cin - console input
int a;
Expand All @@ -19,4 +19,5 @@ main()

cout << "Welcome "<<name<<" "<<surname<<endl;

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using namespace std;

main()
int main()
{
int a=10,b=5;

Expand All @@ -18,4 +18,5 @@ main()
cout << a++ <<endl; //Post-Increment
cout << a-- <<endl; //Post-decrement

return 0;
}
4 changes: 3 additions & 1 deletion CPP006_Relational_Operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace std;

main()
int main()
{
cout<<"Relational Operators !"<<endl;

Expand All @@ -21,4 +21,6 @@ main()
cout << (a<=b)<<endl;
cout << (a>=b)<<endl;
cout << !(a==b)<<endl; // (a!=b)

return 0;
}
3 changes: 2 additions & 1 deletion CPP007_Logical_Operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace std;

main()
int main()
{
// AND - &&
// True only when both the expressions are true
Expand All @@ -25,4 +25,5 @@ main()
// Return true if result is false and vice versa.
cout << !(7>5 && 5!=10) <<endl;

return 0;
}
4 changes: 3 additions & 1 deletion CPP008_Calculator_Exercise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <iostream>
using namespace std;

main()
int main()
{
double var1, var2;

Expand Down Expand Up @@ -59,4 +59,6 @@ main()

if (decision2 == 'y' || decision2 == 'Y')
goto beginning;

return 0;
}
4 changes: 3 additions & 1 deletion CPP009_Arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <iostream>
using namespace std;

main()
int main()
{
int array[4]; //Type_Name[Size_of_Elements]

Expand All @@ -24,4 +24,6 @@ main()

if(&array[0] == array)
cout<<"TRUE";

return 0;
}
4 changes: 3 additions & 1 deletion CPP010_Multidimensional_Arrays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <iostream>
using namespace std;

main()
int main()
{
int biArray[3][4]={0}; //Initialize all array elements to zero

Expand All @@ -30,4 +30,6 @@ main()
cout<<biArray[0][0]<<","<<biArray[0][1]<<","<<biArray[0][2]<<","<<biArray[0][3]<<endl;
cout<<biArray[1][0]<<","<<biArray[1][1]<<","<<biArray[1][2]<<","<<biArray[1][3]<<endl;
cout<<biArray[2][0]<<","<<biArray[2][1]<<","<<biArray[2][2]<<","<<biArray[2][3]<<endl;

return 0;
}
4 changes: 3 additions & 1 deletion CPP011_For.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include<iostream>
using namespace std;

main() {
int main() {
/*
for(initialization;condition;inc/dec)
instructions_to_repeat;
Expand All @@ -28,4 +28,6 @@
for(;;)
cout<<"Stop me if you can !"<<endl;
*/

return 0;
}
4 changes: 3 additions & 1 deletion CPP012_While_DoWhile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include<iostream>
using namespace std;

main() {
int main() {
int i=0;
while(i<10) {
cout<<"Hello"<<endl;
Expand All @@ -24,4 +24,6 @@ main() {
i--;
}
while(i);

return 0;
}
4 changes: 3 additions & 1 deletion CPP013_Counting_Digits_Exercise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include<iostream>
using namespace std;

main() {
int main() {
int num,digits_count=1;
cin>>num;
int temp=num;
Expand All @@ -16,4 +16,6 @@ main() {
digits_count++;

cout<<"The number "<<num<<" has "<<digits_count<<" digit(s)"<<endl;

return 0;
}
4 changes: 3 additions & 1 deletion CPP014_Nested_Loops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include<iostream>
using namespace std;

main() {
int main() {
for(int i=1;i<=10;i++) {
cout<<"Multiplication table of "<<i<<endl;
for(int j=1;j<=10;j++) {
Expand All @@ -15,4 +15,6 @@ main() {
}
cout<<endl;
}

return 0;
}
4 changes: 3 additions & 1 deletion CPP015_Break_Continue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include<iostream>
using namespace std;

main() {
int main() {
for(int i=1;i<=10;i++) {
if(i==3)
continue; //Everything after continue WONT BE executed.
Expand All @@ -22,4 +22,6 @@ main() {
}
cout<<endl;
}

return 0;
}
3 changes: 2 additions & 1 deletion CPP016_Variables_Scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace std;

int globalVariable;

main() {
int main() {

//Variables declared within a block are called Local Variables.
int localVariable;
Expand All @@ -27,4 +27,5 @@ main() {
cout<<result; // Error as result is local to the if block
*/

return 0;
}