Hello..i tied a lot but i am not able to get the answer..
i am writing a program in which user input the array with space as delimiter
eg-
4 3 5
2 3
so this value should be stored in array as
a[0][0]=4
a[0][1]=3
a[0][2]=5
a[1][0]=2
a[1][1]=3
a[1][2]=0
please help me in this
ankit.4aug
0
Newbie Poster
Recommended Answers
Jump to PostTry this reference
Jump to PostHow are you accepting the delimiter, by ' '? or ascii character? and what is your end of line ('\n')? I mean how are you parsing the input, post the code and I may be able to help.
Jump to PostYou could also use the stringstream class from C++. Here's a little example:
#include <iostream> #include <string> #include <sstream> #define SIZE 10 using namespace std; bool isInt(string s){ //checks if …
Jump to PostWell if you cant use a stringstream you could always stor the line in a string and then manually parse the string yourself. The atoi() function will convert a
char*
into the int …
Jump to Postmy code is totally correct ...because i compile and then post here!
i am using borland c++ compiler..
All 20 Replies
tinstaafl
1,176
Posting Maven
Mav3rick
0
Newbie Poster
Lucaci Andrew
140
Za s|n
ankit.4aug
commented:
thanks
+1
ankit.4aug
0
Newbie Poster
ankit.4aug
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
ankit.4aug
commented:
thanks a lot
+1
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
NathanOliver
429
Veteran Poster
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
NathanOliver
429
Veteran Poster
Featured Poster
ankit.4aug
0
Newbie Poster
asifalizaman
1
Junior Poster
deceptikon
commented:
Your code fails to compile. Please learn a bit more before trying to help.
-3
ankit.4aug
commented:
not good
+0
asifalizaman
1
Junior Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
NathanOliver
429
Veteran Poster
Featured Poster
asifalizaman
1
Junior Poster
NathanOliver
429
Veteran Poster
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
tinstaafl
1,176
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.