Hw2Examples

Hw2Examples - String^ fname = Console::ReadLine();...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
// characterOutput.cpp : main project file. #include "stdafx.h" #include <iostream> using namespace System; using namespace std; int main(array<System::String ^> ^args) { char a = 'a'; wchar_t c1, c2; c1 = static_cast <wchar_t> (a); c2 = a; Console::WriteLine(L"c1 = {0}, c2 = {1}", c1.ToString(), c2.ToString()); Console::WriteLine(L"c1 = {0}, c2 = {1}", c1, c2); return 0; }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
#include "stdafx.h" #include <fstream> #include <iostream> #include < stdlib.h > #include < vcclr.h > using namespace System; using namespace std; int main(array<System::String ^> ^args) { ifstream inpt; Console::WriteLine(L"Enter the input file name");
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: String^ fname = Console::ReadLine(); pin_ptr&lt;const wchar_t&gt; wch = PtrToStringChars(fname); size_t origsize = ((fname-&gt;Length + 1) * 2); // length in bytes const size_t newsize = 80; size_t convertedChars = 0; char inFile[newsize]; wcstombs_s(&amp;convertedChars, inFile, origsize, wch, _TRUNCATE); inpt.open(inFile); // inpt.open(&quot;board.dat&quot;); int board[80]; int size; inpt &gt;&gt; size; cout &lt;&lt; size &lt;&lt; endl; for (int j = 0; j &lt; size; j++) {inpt &gt;&gt; board[j]; cout &lt;&lt; board[j] &lt;&lt; endl; } inpt.close(); return 0; }...
View Full Document

Page1 / 2

Hw2Examples - String^ fname = Console::ReadLine();...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online