Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
Victor Nijegorodov19-Sep-19 6:33
Victor Nijegorodov19-Sep-19 6:33 
GeneralRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
Member 1457555619-Sep-19 6:37
Member 1457555619-Sep-19 6:37 
GeneralRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
Victor Nijegorodov19-Sep-19 8:12
Victor Nijegorodov19-Sep-19 8:12 
AnswerRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
David Crow19-Sep-19 6:47
David Crow19-Sep-19 6:47 
GeneralRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
Member 1457555619-Sep-19 6:50
Member 1457555619-Sep-19 6:50 
GeneralRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
Victor Nijegorodov19-Sep-19 8:09
Victor Nijegorodov19-Sep-19 8:09 
SuggestionRe: MFC VC++ Repopulating the ClistCtrl after database is updated through dialog Pin
David Crow19-Sep-19 9:29
David Crow19-Sep-19 9:29 
QuestionDetermining length of Switch compare Pin
ForNow18-Sep-19 15:45
ForNow18-Sep-19 15:45 
AnswerRe: Determining length of Switch compare Pin
Peter_in_278018-Sep-19 16:49
professionalPeter_in_278018-Sep-19 16:49 
GeneralRe: Determining length of Switch compare Pin
ForNow19-Sep-19 1:32
ForNow19-Sep-19 1:32 
AnswerRe: Determining length of Switch compare Pin
Richard MacCutchan18-Sep-19 20:55
mveRichard MacCutchan18-Sep-19 20:55 
GeneralRe: Determining length of Switch compare Pin
ForNow19-Sep-19 1:32
ForNow19-Sep-19 1:32 
AnswerRe: Determining length of Switch compare Pin
Stefan_Lang19-Sep-19 2:23
Stefan_Lang19-Sep-19 2:23 
GeneralRe: Determining length of Switch compare Pin
ForNow19-Sep-19 4:06
ForNow19-Sep-19 4:06 
AnswerRe: Determining length of Switch compare Pin
leon de boer19-Sep-19 4:38
leon de boer19-Sep-19 4:38 
GeneralRe: Determining length of Switch compare Pin
ForNow19-Sep-19 5:11
ForNow19-Sep-19 5:11 
GeneralRe: Determining length of Switch compare Pin
leon de boer28-Sep-19 14:57
leon de boer28-Sep-19 14:57 
QuestionC++ string assignment to struct Pin
Fotsing18-Sep-19 11:54
Fotsing18-Sep-19 11:54 
AnswerRe: C++ string assignment to struct Pin
Richard MacCutchan18-Sep-19 20:26
mveRichard MacCutchan18-Sep-19 20:26 
GeneralRe: C++ string assignment to struct Pin
Fotsing18-Sep-19 22:33
Fotsing18-Sep-19 22:33 
GeneralRe: C++ string assignment to struct Pin
Stefan_Lang19-Sep-19 2:12
Stefan_Lang19-Sep-19 2:12 
GeneralRe: C++ string assignment to struct Pin
Fotsing19-Sep-19 13:06
Fotsing19-Sep-19 13:06 
AnswerRe: C++ string assignment to struct Pin
Victor Nijegorodov18-Sep-19 20:30
Victor Nijegorodov18-Sep-19 20:30 
GeneralRe: C++ string assignment to struct Pin
Fotsing18-Sep-19 22:28
Fotsing18-Sep-19 22:28 
no it is not a pseudo code am trying to write a program that can register a contact, delete or update the contact. so when i compile the is an error message "invalid array assignment" within the the delete function which is the code i posted before. the complete code is
  <pre>#include<iostream>
#include<conio.h>
#include<string.h>
#include<fstream>

using namespace std;
enum type{ home,work,fax,mobile,other };
struct contact{
	char num[15];
	char name[20];
	char TphoneN[6];
}phone[5];
const int max=5;
int index=0;

//reading function
bool reading(){
	char v;
	if(index<=5){
		cout<<"please enter phone number: ";
		gets(phone[index].num);
	
		cout<<"please enter the name: ";
		gets(phone[index].name);
	
		cout<<"the type of number( fax,  mobile,  home,  work,  other): ";
		gets(phone[index].TphoneN);
		/*cin>>v;
		switch(v){
			case 'f': phone[index].TphoneN='fax';
				break;
			case 'm': phone[index].TphoneN='mobile';
				break;
			case 'h': phone[index].TphoneN='home';
				break;
			case 'w': phone[index].TphoneN='work';
				break;
			case 'o': phone[index].TphoneN='other';
				break;
			default: cout<<"please enter a valid key: ";
		}*/
		index++;
		
		return true;
	}
	else 
		return false;
			
	}

//deleting function
bool delet(){
	int flag=0;
	cout<<"please enter the name of the person u wanna delete: ";
	char del[20];
	cin.getline(del,20);
	for(int i=0; i<=index; ++i){
		if(phone[i].name==del){
			for(int j=i; j<=index; ++j){
			
				phone[j].num=phone[j+1].num;
				phone[j].TphoneN=phone[j+1].TphoneN;
				phone[j].name=phone[j+1].name;
		 }
		 flag=1;
		}
}
	
	if(!flag){
		return false;
	}
	else{
			index--;
		return true;
	}
}

//function displqying all contacts
void all(){
	for(int i=0; i<=index; ++i){
		cout<<phone[i].name<<"\t"<<phone[i].num<<"\t"<<phone[i].TphoneN<<endl;
		cout<<"\n";
	}
}

//main function
int main(){
	int x;
	while(!0){
		cout<<"****"<<index<<"contact entries **** \n";
		cout<<"0 end \n1 new contact \n2 delete contact \n3 all contact \n4 empty contact memory";
		cin>>x;
		switch(x){
			case 1:
				bool y=reading();
				if(y==true){
					cout<<"contact successfuly saved";
				}
				else
					cout<<"an error accure could not save your contact";
			break;
			case 2:
			bool y=delet();
				if(y==true){
				cout<<"contact successfuly deleted";
			}
			else
				cout<<"sorry your name does not exist";
			break;
			case 3:
				all();
				break;
			case 4:
				cout<<"still searching";
				break;
			default:
				cout<<"sorry invalid key";
				break;
		}
	}
}




AnswerRe: C++ string assignment to struct Pin
CPallini18-Sep-19 21:01
mveCPallini18-Sep-19 21:01 

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.