int number_of_new = 0; char nyt_valutanavn[10]; double ny_conversion; do { cout << "How many currencies do you want to add?"; cin >> number_of_new; }while (number_of_new < 0); number_of_new +=3; Currency* pCurrencies = new Currency[number_of_new];
for(int i = 0; i < number_of_new ; i++) { cout << "Write the name of value nr "<< (i+1) <<" (max 10 chars.):"; cin >> nyt_valutanavn[10]; pCurrencies[i]->valutanavn = nyt_valutanavn; }
for(int i = 0; i < number_of_new ; i++) { cout << "Write the currency conversion to US$ for value no. "<< (i+1) <<" (max 10 chars.):"; cin >> ny_conversion; pCurrencies[i]->conversion = 10; }
Men når jeg når til linjen: pCurrencies[i]->valutanavn = nyt_valutanavn;, brokker compileren sig og siger base operand not of pointer type.
Kommunerne har digitaliseret indgangen for borgerne. Men bag skærmen håndteres mange arbejdsgange stadig manuelt mellem systemer, mails og organisatoriske siloer.
int number_of_new = 0; string nyt_valutanavn; double ny_conversion; do { cout << "How many currencies do you want to add?"; cin >> number_of_new; }while (number_of_new < 0); Currency* pCurrencies = new Currency[number_of_new];
for(int i = 0; i < number_of_new ; i++) { cout << "Write the name of currency number " << (i+1) << " :"; getline(cin, nyt_valutanavn); cout << endl; pCurrencies[i].valutanavn = nyt_valutanavn;
cout << "Write the currency conversion to US$ for value no. "<< (i+1) <<" :"; cin >> ny_conversion; pCurrencies[i].conversion = ny_conversion; }
int number_of_currencies = sizeof pCurrencies/ sizeof pCurrencies[0];
int convert_from, convert_to; int exit_status = 1; while(exit_status != 0) {
Tusind tak for hjælpen igen Arne, det funger nu :-)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.