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 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 PostI Didn't know they had
strtol()
. I can still see cases where you have to validate the string though. If someone enters 'a' and you convert it to base 10strtol()
will return 0 since the conversion failed but you dont know if the conversion failed or if the user …
Jump to Postmy code is totally correct ...because i compile and then post here!
i am using borland c++ compiler..
Jump to Postmy code is totally correct ...because i compile and then post here!
Repeating this over and over again doesn't make you right.
Try it on a compiler which wasn't developed back in the day when we still used floppy-disks and you'll see that you're wrong.
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.