-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaf8a8b
commit 8ceda6d
Showing
13 changed files
with
162 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
/* array declaration + initialization from keyboard | ||
*/ | ||
|
||
#include<iostream> | ||
#include<stdlib.h> | ||
#include<iomanip> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* selection sort algorithm | ||
made by : | ||
*/ | ||
#include<iostream> | ||
#include "io.cpp" | ||
using namespace std; | ||
void selection_sort(int x[] ,int n) | ||
{ | ||
int i,j,low,pos,temp; | ||
for(i=0;i<n;i++) | ||
{ | ||
low = x[i]; | ||
pos = i; | ||
for(j=i+1;j<n;j++){ | ||
if(x[j]>low) | ||
{ | ||
low = x[j]; | ||
pos= j; | ||
} | ||
} | ||
temp = x[i]; | ||
x[i]= x[pos]; | ||
x[pos]= temp; | ||
|
||
} | ||
} | ||
|
||
|
||
int main() | ||
{ | ||
int x[10]; | ||
input(x,10); | ||
selection_sort(x,10); | ||
cout<<"\n sorted Array :"; | ||
output(x,10); | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]; | ||
int i; | ||
for(i=0;i<10;i++) | ||
cin>>string[i]; | ||
string[10]='\0'; | ||
cout<<"\n Entered String :"<<string; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]; | ||
cin>>string; | ||
cout<<"\n Entered String :"<<string; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]; | ||
cin.getline(string,100,'#'); | ||
cout<<"\n Entered String :"<<string; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]; | ||
gets(string); | ||
cout<<"\n Entered String :"<<string; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string1[100]="This is me"; | ||
char string2[100]; | ||
|
||
//string2 = string1; | ||
|
||
strcpy(string2, string1); | ||
cout<<"Copied String :"<<string2; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]="This is me "; | ||
|
||
cout<<"\n Entered String :"<<string; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]="This is me "; | ||
int i=0; | ||
while(string[i]!='\0') | ||
{ | ||
cout<<string[i]; | ||
i++; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]="This is me "; | ||
cout.write(string,5); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include<iostream> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]="ProgrammingFun"; | ||
int i; | ||
for(i=1;i<=14;i++) | ||
{ cout.write(string,i); | ||
cout<<endl; | ||
} | ||
for(i;i>=1;i--) | ||
{ cout.write(string,i); | ||
cout<<endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include<iostream> | ||
#include<string.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
char string[100]; | ||
int i; | ||
cin.getline(string,100); | ||
|
||
int n = strlen(string); | ||
|
||
cout<<"\n Size of string :"<<n<<endl; | ||
|
||
for(i=1;i<=n;i++) | ||
{ cout.write(string,i); | ||
cout<<endl; | ||
} | ||
for(i=i-1;i>=1;i--) | ||
{ cout.write(string,i); | ||
cout<<endl; | ||
} | ||
return 0; | ||
} |