473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how can i input several numbers in the same line?

7
hi im the beginner of the c++ ...how can i build the programm so that in the output box i can input a number n in the first line and in the second line i input n numbers on the same line with a space in between each number next to it..and the output will displayed the same numbers that i have entered but in a reverse way with space in between the each number next to it..
for example..
input: 5
2 1 4 3 6

output: 6 3 4 2 1
Nov 8 '06 #1
1 4290
sicarie
4,677 Expert Mod 4TB
hi im the beginner of the c++ ...how can i build the programm so that in the output box i can input a number n in the first line and in the second line i input n numbers on the same line with a space in between each number next to it..and the output will displayed the same numbers that i have entered but in a reverse way with space in between the each number next to it..
for example..
input: 5
2 1 4 3 6

output: 6 3 4 2 1
It sounds like you need to use 'getline()' to read them into an array, and then output the array from last to first.

Here is a bit of reading on getline():
http://www.codecomments.com/archive2...-1-377516.html

And here is a bit on the intro stuff, if you need help with arrays:
http://www.informit.com/articles/art...p?p=25281&rl=1

There's a place for you to start. Feel free to post more when you have it.
Nov 8 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: leroybt.rm | last post by:
I don't understand why this does not work: <FILE1> test1.py #Import Packages import string # data=0 data=data+1
1
by: Yong Wang | last post by:
Hi, All: I need to read a input file as soucre to process data. Ideally if I can read a line from input file as a list (coloumn separate by white space), reorganize field in a line. Does python...
3
by: dOleAviSc | last post by:
i have an input file with several numbers (ie 73296^4832 /n) carrot being a space and /n meaning theres another line of similar type numbers underneath. i'm trying to read them in one at a time into...
9
by: bu0461 | last post by:
Hi this is my first post! I'm currently learning C programming language and have just finished structure section. At this point I think I'm able to program some very basic text command line games....
2
by: BDthatsme | last post by:
I can't get any of the various examples of keyboard input to work using command line PHP. I have Windows XP Pro SP 2 and PHP 5.1.6 (cli) (built: Aug 23 2006 16:35:53). I can't find any info...
26
by: Bert | last post by:
Hi, I'm unhappy: why doesn't this work? char enc; char temp; for(int i=0;i<10000;i++){ fscanf(in,"%s",&temp); if(temp=='#')break; else
4
by: newtopython | last post by:
using Python 2.6.1 on windows vista. I would like this search to check if all the numbers or words are in the line and add to the count if all are in the line. But if any one is not, go to the...
2
by: mk112 | last post by:
Is there any way we could input many numbers in a Textbox and Parse it so it will read that many number, like the way we can use getchar to do this in C (for example in put : 1 2 3 and it reads...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.