Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-26-2007, 06:39 PM
sexy_housto sexy_housto is offline
Newbie
 
Join Date: Sep 2007
Posts: 2
Rep Power: 0
sexy_housto is on a distinguished road
Question how to read ten words in array and store thim ?

and after that i wanna display them and i have to use the string class
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 09-26-2007, 11:45 PM
sexy_housto sexy_housto is offline
Newbie
 
Join Date: Sep 2007
Posts: 2
Rep Power: 0
sexy_housto is on a distinguished road
Default help

help plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz .
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-27-2007, 01:00 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,650
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Are you allowed to use other STL-features, like a vector? It will make it a lot easier for you, because it dynamically resizes if you're putting over 10 items in it.
Code:
// vector-version
#include <iostream>
#include <vector>
#include <string>
// ...
	std::string InputString;
	std::vector<std::string> VectorOfStrings;
	for(int i = 0; i < 10; i++)
	{
		std::cout << "Enter string: ";
		std::getline(std::cin, InputString);
		VectorOfStrings.push_back(InputString);
	}
Code:
// non-vector-version
#include <iostream>
#include <string>
// ...
	std::string ArrayOfStrings[10];
	for(int i = 0; i < 10; i++)
	{
		std::cout << "Enter string: ";
		std::getline(std::cin, ArrayOfStrings[i]);
	}
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to store file contents in an array? vithasekar Java Help 2 01-13-2007 03:24 AM


All times are GMT -5. The time now is 03:35 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%

Ads