i wrote but the Read function is just for a single character
any function for int numbers?

int i = Console::Read();
    Console::WriteLine(i);

Recommended Answers

One way is to call ReadLine() then convert the String to int using Convert::ToInt(str)

Jump to Post

All 3 Replies

One way is to call ReadLine() then convert the String to int using Convert::ToInt(str)

thanks

You can still use the standard C++ methods like cin:

#include "stdafx.h"
#include <iostream>
using namespace System;
using namespace std;
int _tmain()
{
    int i;
    cin >> i;
    Console::WriteLine(i);
    Console::ReadLine();
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.