0
我編譯提到的源時發現錯誤。 我想循環到字符串數組增加numberer數組。像作爲我如何使用循環與C + +中的字符串數組
1 + st = 1st;
2 + nd = 2nd;
3 + rd = 3rd;
我的代碼如下
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(){
int value=1;
int ivalue;
int sum=0;
int average;
int x,y;
int count=0;
string A[5]={"st","nd","rd","th","th"};
cout << "Enter loop limit : "; cin >> value ;
cout<<endl;
cout<<endl;
for(x=0;x<=value-1;x++){
for (x=0;x<=A[5];x++)
cout << "Enter "<<x+1<<A[0]<<" value : "; cin >> ivalue;
sum=sum+ivalue;
count++;
}