samedi 6 avril 2019

I'm struggling with my If-statement using Atoi

I'm trying to make a ticket customer code, and I'm currently working with displaying my "customers". I want it to be like, if i type "blank, like nothing then enter" I want all of my customers in my own DTA file to be on my output. In other words displayed, to see which custommers are registred.

void Customer::DisplayCustomer(){

cin.getline(buffer, MAXTEXT)
buffernr = atoi(buffer)   //I need to convert text to numbers. 

if (buffer[0]=='A' && buffer[1] == '\0')
// (Here i have a function which displays everything) don't focus on this 
//  one
}

What I'm asking is, what do i have to type, in order for my code to understand that I want to have a if statement for someone who presses Enter without typing anything my display custommer function will run. I've also tried (If buffer[0]=='\n') but that won't work either.

Aucun commentaire:

Enregistrer un commentaire