| | |
Pls help me... in array problem..
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
helow, can someone help me with my problem. my Teacher give me a problem, he want me to make an array that the output would be my name, buth with a space on it,
example:
Raymond
output:
R a y m o n d
&
R
a
y
m
o
n
d
using array,, pls help me i dont know how to start. im just new with this type of problem...
example:
Raymond
output:
R a y m o n d
&
R
a
y
m
o
n
d
using array,, pls help me i dont know how to start. im just new with this type of problem...
•
•
Join Date: Jul 2008
Posts: 46
Reputation:
Solved Threads: 0
I just got some kind of solution, I think it would work. Try this out, and please tell me if it does the job. Cause I'm a new guy too 
[
]

[
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; void main () { char name[30]; cout<<"Enter a name "; cin.getline(name,30); for (int i = 0; i < strlen(name);i++) { cout<<name[i]<<endl; } }
Last edited by Tekmaven; Jul 26th, 2008 at 2:15 pm. Reason: Code tags
•
•
•
•
I just got some kind of solution, I think it would work. Try this out, and please tell me if it does the job. Cause I'm a new guy too
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; void main () { char name[30]; cout << "Enter a name "; cin.getline ( name, 30 ); for ( int i = 0; i < strlen ( name ); i++ ) { cout << name[i] << endl; } }
That should be int main()
>for ( int i = 0; i < strlen ( name ); i++ )
It is expensive using strlen() within a for loop like that, I by that I don't mean $$.
It also doesn't help doing somebody else's homework.
Last edited by iamthwee; Jul 26th, 2008 at 11:19 am.
*Voted best profile in the world*
•
•
Join Date: Jul 2008
Posts: 46
Reputation:
Solved Threads: 0
Man, I realise that you could solve the problem right away, I know you guys are experienced and these problems are too easy for you. I just wanted to help the dude like some of you guys helped me. And now that he's got the solution, he can look at it, and get new ideas and maybe surprise his teacher, who knows
•
•
•
•
Man, I realise that you could solve the problem right away, I know you guys are experienced and these problems are too easy for you. I just wanted to help the dude like some of you guys helped me. And now that he's got the solution, he can look at it, and get new ideas and maybe surprise his teacher, who knows
I'm a student. If my statements seem too absolute, feel free to coat them with "In my opinion..." or "I believe...".
![]() |
Similar Threads
- For loop problem (Java)
- array problem (Java)
- Find out the problem of my code. (Java)
- Same problem (PHP)
- How do I pass data from a recordset on asp page towards an array on js file (HTML and CSS)
- How do I pass data from a recordset on asp page towards an array on js file (JSP)
- Urgent Pls Help: My codes are in errors! (C++)
- Pls help with C code. Evaluating data types. (C)
- two-dimensional char array (Java)
Other Threads in the C++ Forum
- Previous Thread: vector question
- Next Thread: problem with counter
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






