D
Developwebsites
Are you doing a school assignment? Nothing in your post indicated that.
no i am doing top secret work for the CIA.
Are you doing a school assignment? Nothing in your post indicated that.
I am trying to input names of 5 cities in a for loop, store them in an array,
(not a vector as we havent got there yet), and then print them out.
is this the correct way of doing it:
*/
Developwebsites said:totally confused.
please be more specific.
all i want to do is enter several city names and store them and have them
printed out using a for loop.
all i want to do is enter several city names and store them and have them
printed out using a for loop.
Developwebsites said:/*
I am trying to input names of 5 cities in a for loop, store them in an array,
(not a vector as we havent got there yet), and then print them out.
is this the correct way of doing it:
*/
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
class Cities {
private:
string *city;
Developwebsites said:no i am doing top secret work for the CIA.
Overdue, but:
*plonk*
Brian Rodenborn
string city[5]; // array to store 5 cities
better would be to use a vector
vector<string> city;
Developwebsites said:If you want an array, you have to create one:
string city[5]; // array to store 5 cities
what if the user enters more than 5 cities?
number of cities is unknown, and is set at 0, so string *city seemed to solve
the problem, compiles fine, but yes it does crash.
as I've said we did not cover vector and until we do i am not going to use it.
Developwebsites said:is the only answer you will get from people like him.
*plonk* right back at you shemp lover.
Developwebsites said:is the only answer you will get from people like him.
*plonk* right back at you shemp lover.
Kevin said:Developwebsites wrote:
I've seen a lot of people get good answers from him.
He got tired of your attitude. He's not alone.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.