- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 5
- Posts with Downvotes
- 5
- Downvoting Members
- 3
11 Posted Topics
> can u make me a multiplication table using a for loop and arrays in c++??? > plsss can u?? #include<iostream.h> #include<conio.h> int main() { for (int x=1;x<=10;x++) { for(int i=1;i<=5;i++) cout<<i<<"*"<<x<<"="<<i*x<<"\t\t"; cout<<endl; } system("PAUSE"); return 0; } you can change the variable i value you get 1 to 10 …
[CODE] #include<iostream.h> int main() { int start,end; cout<<"Enter the range by space :"; cin>>start>>end; int count=0; while(start<=end) { if(start%2==0) count++; start++; } cout<<endl<<"Total number of multiple by two is :"<<count<<endl; system("PAUSE"); return 0; } [/CODE]
[CODE]#include<iostream.h> #include<conio.h> int main() { int i,j=0,k,ch; int Matrice[4][5]={1,6,4,8,3,2,3,8,7,0,1,4,5,0,9,2,6,9,0,1}; for(ch=0;ch<10;ch++) { for(i=0;i<4;i++) { for(k=0;k<5;k++) { if(ch==Matrice[i][k]) j++; } } if(j>0) cout<<ch<<" -> "<<j<<endl; j=0; } system("PAUSE"); return 0; }[/CODE]
[CODE]#include<iostream.h> #include<conio.h> #include<math.h> int main() { long int x,array[10]; cout<<"how many value you enter: "; int trials,i=0,y; cin>>trials; while(i<trials) { int count=0; cout<<endl<<"Enter a value:"; cin>>x; while(x!=0) { array[++count]=x%10; x=x/10; } for(int j=count;j>=1;j--) { cout<<array[j]<<"\t"<<pow(array[j],2)<<"\t"<<pow(array[j],3); cout<<endl; } i++; } system("PAUSE"); return 0; }[/CODE]
Hi, Where you find this code.This is C language code!!!!!!!!!!!!!!!!!!!!You can suggestion me where we find this....................
[CODE]#include<iostream.h> #include<time.h> int main() { clock_t start,stop; start=clock(); [/CODE] ::::::your function:::::: [CODE]stop=clock(); cout<<(stop-start)/CLK_TCK; return 0; }[/CODE] I hope this work. other wise you can use this [CODE]#include<iostream.h> #include<time.h> #include<stddef.h> int main() { time_t start,end; start=time(NULL); ::::::Your function:::::: end=time(NULL); cout<<difftime(end,start); return 0; }[/CODE]
[CODE]#include<iostream.h> #include<conio.h> int main() { long int x,y, sum=0; cin>>x; while(x>9) { while(x!=0) { y=x%10; x=x/10; sum=sum+y; } if(x==0) { x=sum; sum=0; } } cout<<x<<endl; system("PAUSE"); return 0; }[/CODE]
This is Straight forward maximum and minimim code [CODE]#include<iostream.h> #include<conio.h> int array[15]; void StraightMaxMin(int n) { int max,min; max=min=array[1]; for(int i=2;i<=n;i++) { if(array[i]>max) max=array[i]; if(array[i]<min) min=array[i]; } cout<<endl<<"Maximum :"<<max; cout<<endl<<"Minimum :"<<min<<endl; } int main() { for(int i=1;i<=15;i++) { array[i]=rand(); } for(int j=1;j<=15;j++) { cout<<array[j]<<" "; } StraightMaxMin(15); system("PAUSE"); return 0; …
[CODE]#include<iostream.h> #include<conio.h> #include<math.h> #define R 50 int x[R], count; int place(int k,int i) { int j; for(j=1;j<k;j++) { if( x[j]==i || abs(x[j]-i)==abs(j-k) ) return 0; } return 1; } void NQueens(int k,int n) { int i,j; for(i=1;i<=n;i++) { if(place(k,i)==1) { x[k]=i; if(k==n) { count++; cout<<"Solution "<<count<<".\n"; cout<<" Row:Column = "; …
this is ur code [CODE]#include<iostream.h> #include<conio.h> int a[10]={0,0,0,0,0,0,0,0,0}; int com(int n,int count) { int k=0; for(int m=0;m<=count;m++) { if(n==a[m]) { k=1; break; } if(n>9) { k=1; break; } } if(k==0) { a[count]=n; } return k; } int main() { int maxt[3][3],temp,i,j,count=0; //int a[10]={0,0,0,0,0,0,0,0,0}; for(i=0;i<3;i++) { for(j=0;j<3;j++) { step1: temp=1+(rand()%10); int …
The End.