hello
im writing a blackjack program and i would like to condense some of it. i was wondering if there was any way to make this into a loop?

Code:
cout<<"how many cards do you have? \n";
		cin>>repeatcard;

		
		if (repeatcard=3 && total<21){
			cout<<"card: "<<number<<endl;
			cout<<"enter the card? \n";
			cin>>card3;
			total=card1+card2+card3;
			cout<<" 3 cards, card total: "<<total<<endl;
			cout<<"do you want another card? ";
			cin>>anothercard;
			}
		if(repeatcard=4 && total<21){
				cout<<"card: "<<number<<endl;
				cout<<"enter the card? \n";
				cin>>card4;
				total=card1+card2+card3+card4;
				cout<<"4 cards, card total: "<<total<<endl;
				cout<<"do you want another card? ";
				cin>>anothercard;
				}
		if (repeatcard=5 &&  total<21){
				cout<<"card: "<<number<<endl;
				cout<<"enter the card? \n";
				cin>>card5;
				total=card1+card2+card3+card4+card5;
				cout<<"5 cards, card total: "<<total<<endl;
				cout<<"do you want another card? ";
				cin>>anothercard;