Click here to Skip to main content
15,900,258 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDirectShow is "no show so far" - need basic help Pin
Vaclav_4-Mar-13 7:18
Vaclav_4-Mar-13 7:18 
AnswerRe: DirectShow is "no show so far" - need basic help Pin
Richard MacCutchan4-Mar-13 22:57
mveRichard MacCutchan4-Mar-13 22:57 
AnswerRe: DirectShow is "no show so far" - need basic help Pin
SoMad4-Mar-13 23:49
professionalSoMad4-Mar-13 23:49 
GeneralJUST update Re: DirectShow is "no show so far" - need basic help Pin
Vaclav_7-Mar-13 5:03
Vaclav_7-Mar-13 5:03 
QuestionHow to adjust Bitmap onto a picture control in mfc.? Pin
mbatra314-Mar-13 2:01
mbatra314-Mar-13 2:01 
AnswerRe: How to adjust Bitmap onto a picture control in mfc.? Pin
Richard MacCutchan4-Mar-13 23:09
mveRichard MacCutchan4-Mar-13 23:09 
GeneralRe: How to adjust Bitmap onto a picture control in mfc.? Pin
mbatra314-Mar-13 23:15
mbatra314-Mar-13 23:15 
GeneralRe: How to adjust Bitmap onto a picture control in mfc.? Pin
Richard MacCutchan5-Mar-13 0:26
mveRichard MacCutchan5-Mar-13 0:26 
QuestionRotating a single object out of 3 in OpenGL Pin
appollosputnik3-Mar-13 23:53
appollosputnik3-Mar-13 23:53 
QuestionHow to owner draw a combobox Pin
haha_c3-Mar-13 23:07
haha_c3-Mar-13 23:07 
AnswerRe: How to owner draw a combobox Pin
Richard MacCutchan3-Mar-13 23:33
mveRichard MacCutchan3-Mar-13 23:33 
QuestionWin32_NetworkAdapter class to change network configuration Pin
Sachin k Rajput 3-Mar-13 20:22
Sachin k Rajput 3-Mar-13 20:22 
AnswerRe: Win32_NetworkAdapter class to change network configuration Pin
David Crow4-Mar-13 3:23
David Crow4-Mar-13 3:23 
GeneralRe: Win32_NetworkAdapter class to change network configuration Pin
Sachin k Rajput 4-Mar-13 16:36
Sachin k Rajput 4-Mar-13 16:36 
QuestionHow to implement such such a gradient path like a ring? Pin
kcynic3-Mar-13 19:14
kcynic3-Mar-13 19:14 
AnswerRe: How to implement such such a gradient path like a ring? Pin
Richard MacCutchan3-Mar-13 22:00
mveRichard MacCutchan3-Mar-13 22:00 
GeneralRe: How to implement such such a gradient path like a ring? Pin
kcynic4-Mar-13 14:18
kcynic4-Mar-13 14:18 
GeneralRe: How to implement such such a gradient path like a ring? Pin
Richard MacCutchan4-Mar-13 22:50
mveRichard MacCutchan4-Mar-13 22:50 
QuestionTab key and delete key is not working in win32 browser control Pin
venkatesh528673-Mar-13 18:22
venkatesh528673-Mar-13 18:22 
AnswerRe: Tab key and delete key is not working in win32 browser control Pin
Richard MacCutchan3-Mar-13 21:58
mveRichard MacCutchan3-Mar-13 21:58 
GeneralMessage Closed Pin
3-Mar-13 22:18
venkatesh528673-Mar-13 22:18 
GeneralRe: Tab key and delete key is not working in win32 browser control Pin
Richard MacCutchan3-Mar-13 23:01
mveRichard MacCutchan3-Mar-13 23:01 
Questionadd element to array c++ Pin
Eshoula Aswomwe3-Mar-13 18:10
Eshoula Aswomwe3-Mar-13 18:10 
Hi guys please I need your help to do a little code at the green comment line in order to do this:


when I try to add new element to an array

Java
4   56    7    10



like 100 at 1 index position

will do this

Java
4   100    7    10  56



it should be like this :

Java
4   100   56   7    10  


so the problem is i have to use swap making swap variable take value and them move the rest on order to make like this

Java
4   100   56   7    10  




Java
  #include<iostream  >
 
using namespace std;
void printarray(int  [], int,int  );
void gradefull( int [],int ,int&);

void add(int [],int ,int) ;
void main(){

	int * gradeArray;
	int g;
	
	int elmentnumber=0;
	cout<<endl;
	cout << "\tEnter the number  of elemetn for the array: " ;
	cin>>g;

	gradeArray=new int[g];

	gradefull(gradeArray,g,elmentnumber);
 
	cout << endl  ;
	printarray(gradeArray,g,elmentnumber);
	
	cout << endl<< endl  ;
	cout<<"Adding New Element:"<<endl<<endl;
	add(  gradeArray , elmentnumber,g);
 
	cout << endl<< endl ;
	system("pause");
}


void gradefull( int gradeArray[],int g,int & elmentnumber ){
	cout<<endl; 
	for ( int i=0;i<g; i++ ){
	int input;
		cout << "please insert the element #<"<< i<<">: ";
		cin>>input;
		gradeArray[i]=input;

		elmentnumber++;
	}

}

void printarray(int gradeArray[], int g,int elmentnumber){
for ( int i=0;i<g; i++ ){
	
		cout<<"\t"<<gradeArray[i] <<" ";

	}	
cout<<endl;
		cout<<endl <<"\tYou entred <"<<elmentnumber << "> elments";
	
}

 
void add(int gradeArray [],int  elmentnumber,int g ){
	 
	int temp;
	  elmentnumber++;
	  int newinput;
		int indix;	
		 
		cout<<endl;
	  cout<<"  Please Enter the postion indix  for the new element: ";
	  cin>>indix;
	  while((indix>elmentnumber)||(indix==elmentnumber)){
	  cout<<"  Please Enter the postion indix  for the new element: ";
	  cin>>indix;
	  }
	   
	   

	 for ( int i=0;i<elmentnumber; i++ ){
	 
		 if ( i==indix){
			 temp=gradeArray[i];
			 cout<<endl<<"\tEnter the new element number: ";
		  cin>>newinput;
		gradeArray[i]=newinput;
		 }
	  
	 } cout<<endl;
	 cout<<"  The new Array after Adding the New element: "<<endl<<endl;
	 if (indix<g){
	  gradeArray[elmentnumber-1]=temp ;
	 }


// here where you should start to fix below :

	 for ( int i=0;i<elmentnumber; i++ ){ 
	  cout<<"\t"<<gradeArray[i] <<" ";
	 }

	    

}


modified 4-Mar-13 5:21am.

QuestionRe: add element to array c++ Pin
CPallini3-Mar-13 21:52
mveCPallini3-Mar-13 21:52 
AnswerRe: add element to array c++ Pin
Richard MacCutchan3-Mar-13 21:57
mveRichard MacCutchan3-Mar-13 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.