Click here to Skip to main content
15,921,226 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to check a directory is existed or not Pin
David Crow18-Sep-07 4:11
David Crow18-Sep-07 4:11 
QuestionString of integers Pin
Herboren17-Sep-07 16:24
Herboren17-Sep-07 16:24 
AnswerRe: String of integers Pin
fefe.wyx17-Sep-07 16:45
fefe.wyx17-Sep-07 16:45 
GeneralRe: String of integers Pin
Herboren17-Sep-07 18:47
Herboren17-Sep-07 18:47 
GeneralRe: String of integers Pin
nbugalia17-Sep-07 19:15
nbugalia17-Sep-07 19:15 
AnswerRe: String of integers Pin
Russell'17-Sep-07 23:24
Russell'17-Sep-07 23:24 
AnswerRe: String of integers Pin
David Crow18-Sep-07 4:17
David Crow18-Sep-07 4:17 
GeneralRe: String of integers [modified] Pin
Herboren18-Sep-07 4:43
Herboren18-Sep-07 4:43 
Russel *Sigh*, if you have a little more to tell me than just "NO" i might actually listen to you. Crow even turning it to a string wouldnt that mean its still in char format and not int. I should be able to add an unspecified amount to each element of the string inside the array. Like adding a 1 to 12345 making it 22345.

<br />
#include "stdafx.h"<br />
#include <conio.h><br />
#include <sstream><br />
#include <string><br />
#include <iostream><br />
#include <cstdlib><br />
using namespace std;<br />
<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
	int aArray[4];<br />
	int u,d,t,q,c,a;<br />
	string st;<br />
<br />
	cout << "Input 5-digits: "; cin >> st; cout << st << endl; _getch();<br />
	istringstream ss(st);<br />
<br />
<br />
	ss >> u;<br />
	aArray[0] = u;<br />
	if ( ss.peek() != '\n' )<br />
	{<br />
		cerr<<"Invalid format"<<endl;<br />
		return EXIT_FAILURE;<br />
	}ss.ignore();<br />
<br />
	ss >> d;<br />
	aArray[1] = d;<br />
	if ( ss.peek() != '\n' )<br />
	{<br />
		cerr<<"Invalid format"<<endl;<br />
		return EXIT_FAILURE;<br />
	}ss.ignore();<br />
<br />
	ss >> t;<br />
	aArray[2] = t;<br />
	if ( ss.peek() != '\n' )<br />
	{<br />
		cerr<<"Invalid format"<<endl;<br />
		return EXIT_FAILURE;<br />
	}ss.ignore();<br />
<br />
	ss >> q;<br />
	aArray[3] = q;<br />
	if ( ss.peek() != '\n' )<br />
	{<br />
		cerr<<"Invalid format"<<endl;<br />
		return EXIT_FAILURE;<br />
	}ss.ignore();<br />
<br />
	ss >> c;<br />
	aArray[4] = c;<br />
	cout << u << d << t << q << c << " "<br />
								  << aArray[0] <br />
								  << aArray[1]<br />
								  << aArray[2]<br />
								  << aArray[3]<br />
								  << aArray[4]<br />
								  << endl;<br />
	cout << aArray[0] << endl;<br />
	_getch();<br />
	return 0;<br />
}<br />
<br />



-- modified at 10:49 Tuesday 18th September, 2007
GeneralRe: String of integers Pin
David Crow18-Sep-07 5:32
David Crow18-Sep-07 5:32 
GeneralRe: String of integers Pin
Herboren18-Sep-07 6:13
Herboren18-Sep-07 6:13 
QuestionRe: String of integers Pin
David Crow18-Sep-07 6:51
David Crow18-Sep-07 6:51 
AnswerRe: String of integers [modified] Pin
Herboren18-Sep-07 9:04
Herboren18-Sep-07 9:04 
GeneralRe: String of integers Pin
David Crow18-Sep-07 10:36
David Crow18-Sep-07 10:36 
GeneralRe: String of integers Pin
Herboren18-Sep-07 10:58
Herboren18-Sep-07 10:58 
QuestionRe: String of integers Pin
David Crow18-Sep-07 11:06
David Crow18-Sep-07 11:06 
AnswerRe: String of integers [modified] Pin
Herboren18-Sep-07 11:17
Herboren18-Sep-07 11:17 
GeneralRe: String of integers Pin
David Crow19-Sep-07 7:58
David Crow19-Sep-07 7:58 
Questioncode for opening,closing and saving an image file Pin
itsgood12317-Sep-07 14:23
itsgood12317-Sep-07 14:23 
AnswerRe: code for opening,closing and saving an image file Pin
Sarath C17-Sep-07 15:49
Sarath C17-Sep-07 15:49 
QuestionRe: code for opening,closing and saving an image file Pin
Mark Salsbery17-Sep-07 18:22
Mark Salsbery17-Sep-07 18:22 
AnswerRe: code for opening,closing and saving an image file Pin
Hamid_RT18-Sep-07 3:15
Hamid_RT18-Sep-07 3:15 
QuestionHow to switch the views by CButton cointrol on CFormview view in MDI Pin
llkkxx17-Sep-07 13:07
llkkxx17-Sep-07 13:07 
AnswerRe: How to switch the views by CButton cointrol on CFormview view in MDI Pin
Vaclav_17-Sep-07 16:10
Vaclav_17-Sep-07 16:10 
QuestionRe: How to switch the views by CButton cointrol on CFormview view in MDI Pin
Nelek17-Sep-07 20:14
protectorNelek17-Sep-07 20:14 
QuestionRe: How to switch the views by CButton cointrol on CFormview view in MDI Pin
Nelek17-Sep-07 20:00
protectorNelek17-Sep-07 20:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.