diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/.vscode/settings.json b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/.vscode/settings.json index 0cba2e68..952e1851 100644 --- a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/.vscode/settings.json +++ b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/.vscode/settings.json @@ -1,5 +1,6 @@ { "files.associations": { - "iostream": "cpp" + "iostream": "cpp", + "iosfwd": "cpp" } } \ No newline at end of file diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOany.exe b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOany.exe new file mode 100644 index 00000000..cf04d535 Binary files /dev/null and b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOany.exe differ diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOdecimal.exe b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOdecimal.exe new file mode 100644 index 00000000..f3de54d3 Binary files /dev/null and b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/anyTOdecimal.exe differ diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.cpp b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.cpp new file mode 100644 index 00000000..9a2cb6da --- /dev/null +++ b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include +using namespace std; +void sum(int n1,int n2,int b) +{ + int r1,r2,c=0; + string res="",ch; + while((n1>0)||(n2>0)) + { + stringstream ss; + r1=n1%10; + r2=n2%10; + if(r1+r2+c>=b) + { + ss<<((r1+r2+c)%b); + ss>>ch; + res.append(ch); + c=1; + } + else + { + ss<<(r1+r2+c); + ss>>ch; + res.append(ch); + c=0; + } + n1=n1/10; + n2=n2/10; + } + if(c!=0) + { stringstream ss; + ss<>ch; + res.append(ch); + } + reverse(res.begin(),res.end()); + cout<>base; + cout<<"Enter number 1 :"; + cin>>num1; + cout<<"Enter number 2 :"; + cin>>num2; + sum(num1,num2,base); + return 0; +} \ No newline at end of file diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.exe b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.exe new file mode 100644 index 00000000..11ab4cc1 Binary files /dev/null and b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/any_base_sum.exe differ diff --git a/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/bar_chart.cpp b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/bar_chart.cpp new file mode 100644 index 00000000..e5c5d5d3 --- /dev/null +++ b/ML/palprashant2002_PrashantKumarPal_2024CSE1146_2/FunctionAndArray/bar_chart.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +int main() +{ + int n,d,ch=0,k=0; + cout<<"Enter size of array : "; + cin>>n; + int arr[n]; + cout<<"Enter elements in array : "; + for(int i=0;i>arr[i]; + } + for(int i=0;i +using namespace std; +int main() +{ + int n,d,ch=0; + cout<<"Enter size of array : "; + cin>>n; + int arr[n]; + cout<<"Enter elements in array : "; + for(int i=0;i>arr[i]; + } + cout<<"Enter element to search in array : "; + cin>>d; + for(int i=0;i +using namespace std; +int main() +{ + int n,min,max,span; + cout<<"Enter size of array : "; + cin>>n; + int arr[n]; + cout<<"Enter elements in array : "; + for(int i=0;i>arr[i]; + } + min=INT_MAX; + max=INT_MIN; + for(int i=0;imax) + max=arr[i]; + if(arr[i] +using namespace std; +int main() +{ + int n1,n2,j=0,c1=0,c2=0,x=0; + cout<<"Enter size of array1 : "; + cin>>n1; + cout<<"Enter size of array2 : "; + cin>>n2; + int ar1[n1],ar2[n2]; + for(int i=0;i>ar1[i]; + } + for(int i=0;i>ar2[i]; + } + if(n1>n2) + { + int sum[n1]; + j=n1-n2; + for(int i=n1-1,j=n2-1;i>=0;i--,j--) + { + if(j>=0) + x=ar2[j]; + else + x=0; + c1=(ar1[i]+x+c2)/10; + sum[i]=(ar1[i]+x+c2)%10; + c2=c1; + } + cout<=0;i--,j--) + { + if(j>=0) + x=ar1[j]; + else + x=0; + c1=(ar2[i]+x+c2)/10; + sum[i]=(ar2[i]+x+c2)%10; + c2=c1; + } + for(int i=0;i