내 프로그램에서 작은 정렬 문제가 있습니다.C++ 테이블 정렬 - cout 및 iomanip
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setw(5) << "Sl. No:" << setw(15) << "Month" << setw(15) << "Name" << endl << endl;
cout << setw(5) << 1 << setw(15) << "January" << setw(15) << "Abhilash" << endl;
cout << setw(5) << 2 << setw(15) << "Februaury" << setw(15) << "Anandan" << endl;
cout << setw(5) << 3 << setw(15) << "March" << setw(15) << "Abhilash" << endl;
cout << setw(5) << 4 << setw(15) << "April" << setw(15) << "Anandan" << endl;
return 0;
}
출력 결과에서 월 이름이 오른쪽 정렬되지 않았습니다.
Sl. No: Month Name
1 January Abhilash
2 Februaury Anandan
3 March Abhilash
4 April Anandan
무엇이 문제입니까?
정말 고마워요. 어리석은 초보자 실수를 상기시켜 주셔서 감사합니다. 문제 해결됨. – Babbzzz